1 ; RUN: llc -O2 < %s | FileCheck %s --check-prefix=CHECK-O2 --check-prefix=CHECK
2 ; RUN: llc -O0 -fast-isel < %s | FileCheck %s --check-prefix=CHECK-O0 --check-prefix=CHECK
3 ; RUN: llc -O0 -fast-isel=0 < %s | FileCheck %s --check-prefix=CHECK-O0 --check-prefix=CHECK
4 ; RUN: llc -O0 -global-isel < %s | FileCheck %s --check-prefix=CHECK-O0 --check-prefix=CHECK
6 ;; Ensure that an unfoldable is.constant gets lowered reasonably in
7 ;; optimized codegen, in particular, that the "true" branch is
10 ;; This isn't asserting any specific output from non-optimized runs,
11 ;; (e.g., currently the not-taken branch does not get eliminated). But
12 ;; it does ensure that lowering succeeds in all 3 codegen paths.
14 target triple = "x86_64-unknown-linux-gnu"
16 declare i1 @llvm.is.constant.i32(i32 %a) nounwind readnone
17 declare i1 @llvm.is.constant.i64(i64 %a) nounwind readnone
18 declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1) nounwind readnone
20 declare i32 @subfun_1()
21 declare i32 @subfun_2()
23 define i32 @test_branch(i32 %in) nounwind {
24 ; CHECK-LABEL: test_branch:
26 ; CHECK-O2-NEXT: jmp subfun_2
27 %v = call i1 @llvm.is.constant.i32(i32 %in)
28 br i1 %v, label %True, label %False
31 %call1 = tail call i32 @subfun_1()
35 %call2 = tail call i32 @subfun_2()
39 ;; llvm.objectsize is another tricky case which gets folded to -1 very
40 ;; late in the game. We'd like to ensure that llvm.is.constant of
41 ;; llvm.objectsize is true.
42 define i1 @test_objectsize(i8* %obj) nounwind {
43 ; CHECK-LABEL: test_objectsize:
45 ; CHECK-O2: movb $1, %al
47 %os = call i64 @llvm.objectsize.i64.p0i8(i8* %obj, i1 false, i1 false, i1 false)
48 %v = call i1 @llvm.is.constant.i64(i64 %os)