llvm-project/lld/test/MachO/objc-arc-contract.ll
Jez Ng 697f4e429b [lld-macho] Run ObjCContractPass during LTO
Run the ObjCARCContractPass during LTO. The legacy LTO backend (under
LTO/ThinLTOCodeGenerator.cpp) already does this; this diff just adds that
behavior to the new LTO backend. Without that pass, the objc.clang.arc.use
intrinsic will get passed to the instruction selector, which doesn't know how to
handle it.

In order to test both the new and old pass managers, I've also added support for
the `--[no-]lto-legacy-pass-manager` flags.

P.S. Not sure if the ordering of the pass within the pipeline matters...

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D94547
2021-01-20 14:21:32 -05:00

31 lines
1.0 KiB
LLVM

; REQUIRES: x86
;; Verify that we run the ObjCARCContractPass during LTO. Without that, the
;; objc.clang.arc.use intrinsic will get passed to the instruction selector,
;; which doesn't know how to handle it.
; RUN: llvm-as %s -o %t.o
; RUN: %lld -dylib -lSystem %t.o -o %t --lto-legacy-pass-manager
; RUN: llvm-objdump -d %t | FileCheck %s
; RUN: %lld -dylib -lSystem %t.o -o %t --no-lto-legacy-pass-manager
; RUN: llvm-objdump -d %t | FileCheck %s
; RUN: opt -module-summary %s -o %t.o
; RUN: %lld -dylib -lSystem %t.o -o %t --lto-legacy-pass-manager
; RUN: llvm-objdump -d %t | FileCheck %s
; RUN: %lld -dylib -lSystem %t.o -o %t --no-lto-legacy-pass-manager
; RUN: llvm-objdump -d %t | FileCheck %s
; CHECK: <_foo>:
; CHECK-NEXT: retq
target triple = "x86_64-apple-darwin"
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
define void @foo(i8* %a, i8* %b) {
call void (...) @llvm.objc.clang.arc.use(i8* %a, i8* %b) nounwind
ret void
}
declare void @llvm.objc.clang.arc.use(...) nounwind