diff options
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll | 17 | ||||
-rw-r--r-- | llvm/test/CodeGen/AArch64/O0-pipeline.ll | 1 | ||||
-rw-r--r-- | llvm/test/CodeGen/AArch64/O3-pipeline.ll | 1 | ||||
-rw-r--r-- | llvm/test/CodeGen/ARM/O3-pipeline.ll | 1 | ||||
-rw-r--r-- | llvm/test/CodeGen/Generic/is-constant.ll | 114 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/O0-pipeline.ll | 1 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/O3-pipeline.ll | 1 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/is-constant.ll | 50 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/object-size.ll | 55 |
9 files changed, 5 insertions, 236 deletions
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll index 4f9dcd1686a..598510df98a 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll +++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll @@ -1183,23 +1183,6 @@ define void @test_memset(i8* %dst, i8 %val, i64 %size) { ret void } -declare i64 @llvm.objectsize.i64(i8*, i1) -declare i32 @llvm.objectsize.i32(i8*, i1) -define void @test_objectsize(i8* %addr0, i8* %addr1) { -; CHECK-LABEL: name: test_objectsize -; CHECK: [[ADDR0:%[0-9]+]]:_(p0) = COPY $x0 -; CHECK: [[ADDR1:%[0-9]+]]:_(p0) = COPY $x1 -; CHECK: {{%[0-9]+}}:_(s64) = G_CONSTANT i64 -1 -; CHECK: {{%[0-9]+}}:_(s64) = G_CONSTANT i64 0 -; CHECK: {{%[0-9]+}}:_(s32) = G_CONSTANT i32 -1 -; CHECK: {{%[0-9]+}}:_(s32) = G_CONSTANT i32 0 - %size64.0 = call i64 @llvm.objectsize.i64(i8* %addr0, i1 0) - %size64.intmin = call i64 @llvm.objectsize.i64(i8* %addr0, i1 1) - %size32.0 = call i32 @llvm.objectsize.i32(i8* %addr0, i1 0) - %size32.intmin = call i32 @llvm.objectsize.i32(i8* %addr0, i1 1) - ret void -} - define void @test_large_const(i128* %addr) { ; CHECK-LABEL: name: test_large_const ; CHECK: [[ADDR:%[0-9]+]]:_(p0) = COPY $x0 diff --git a/llvm/test/CodeGen/AArch64/O0-pipeline.ll b/llvm/test/CodeGen/AArch64/O0-pipeline.ll index 9611946f710..20214fb83f4 100644 --- a/llvm/test/CodeGen/AArch64/O0-pipeline.ll +++ b/llvm/test/CodeGen/AArch64/O0-pipeline.ll @@ -21,6 +21,7 @@ ; CHECK-NEXT: Module Verifier ; CHECK-NEXT: Lower Garbage Collection Instructions ; CHECK-NEXT: Shadow Stack GC Lowering +; CHECK-NEXT: Lower constant intrinsics ; CHECK-NEXT: Remove unreachable blocks from the CFG ; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (post inlining) ; CHECK-NEXT: Scalarize Masked Memory Intrinsics diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll index 35417deec1a..f483d631167 100644 --- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll +++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll @@ -38,6 +38,7 @@ ; CHECK-NEXT: Expand memcmp() to load/stores ; CHECK-NEXT: Lower Garbage Collection Instructions ; CHECK-NEXT: Shadow Stack GC Lowering +; CHECK-NEXT: Lower constant intrinsics ; CHECK-NEXT: Remove unreachable blocks from the CFG ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Natural Loop Information diff --git a/llvm/test/CodeGen/ARM/O3-pipeline.ll b/llvm/test/CodeGen/ARM/O3-pipeline.ll index cbfc1e86a36..6cc7e53aeff 100644 --- a/llvm/test/CodeGen/ARM/O3-pipeline.ll +++ b/llvm/test/CodeGen/ARM/O3-pipeline.ll @@ -22,6 +22,7 @@ ; CHECK-NEXT: Expand memcmp() to load/stores ; CHECK-NEXT: Lower Garbage Collection Instructions ; CHECK-NEXT: Shadow Stack GC Lowering +; CHECK-NEXT: Lower constant intrinsics ; CHECK-NEXT: Remove unreachable blocks from the CFG ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Natural Loop Information diff --git a/llvm/test/CodeGen/Generic/is-constant.ll b/llvm/test/CodeGen/Generic/is-constant.ll deleted file mode 100644 index 2e1f4261d6a..00000000000 --- a/llvm/test/CodeGen/Generic/is-constant.ll +++ /dev/null @@ -1,114 +0,0 @@ -; RUN: opt -O2 -S < %s | FileCheck %s -; RUN: llc -o /dev/null 2>&1 < %s -; RUN: llc -O0 -o /dev/null 2>&1 < %s - -;; The llc runs above are just to ensure it doesn't blow up upon -;; seeing an is_constant intrinsic. - -declare i1 @llvm.is.constant.i32(i32 %a) -declare i1 @llvm.is.constant.i64(i64 %a) -declare i1 @llvm.is.constant.i256(i256 %a) -declare i1 @llvm.is.constant.v2i64(<2 x i64> %a) -declare i1 @llvm.is.constant.f32(float %a) -declare i1 @llvm.is.constant.sl_i32i32s({i32, i32} %a) -declare i1 @llvm.is.constant.a2i64([2 x i64] %a) -declare i1 @llvm.is.constant.p0i64(i64* %a) - -;; Basic test that optimization folds away the is.constant when given -;; a constant. -define i1 @test_constant() #0 { -; CHECK-LABEL: @test_constant( -; CHECK-NOT: llvm.is.constant -; CHECK: ret i1 true -%y = call i1 @llvm.is.constant.i32(i32 44) - ret i1 %y -} - -;; And test that the intrinsic sticks around when given a -;; non-constant. -define i1 @test_nonconstant(i32 %x) #0 { -; CHECK-LABEL: @test_nonconstant( -; CHECK: @llvm.is.constant - %y = call i1 @llvm.is.constant.i32(i32 %x) - ret i1 %y -} - -;; Ensure that nested is.constants fold. -define i32 @test_nested() #0 { -; CHECK-LABEL: @test_nested( -; CHECK-NOT: llvm.is.constant -; CHECK: ret i32 13 - %val1 = call i1 @llvm.is.constant.i32(i32 27) - %val2 = zext i1 %val1 to i32 - %val3 = add i32 %val2, 12 - %1 = call i1 @llvm.is.constant.i32(i32 %val3) - %2 = zext i1 %1 to i32 - %3 = add i32 %2, 12 - ret i32 %3 -} - -@G = global [2 x i64] zeroinitializer -define i1 @test_global() #0 { -; CHECK-LABEL: @test_global( -; CHECK: llvm.is.constant - %ret = call i1 @llvm.is.constant.p0i64(i64* getelementptr ([2 x i64], [2 x i64]* @G, i32 0, i32 0)) - ret i1 %ret -} - -define i1 @test_diff() #0 { -; CHECK-LABEL: @test_diff( - %ret = call i1 @llvm.is.constant.i64(i64 sub ( - i64 ptrtoint (i64* getelementptr inbounds ([2 x i64], [2 x i64]* @G, i64 0, i64 1) to i64), - i64 ptrtoint ([2 x i64]* @G to i64))) - ret i1 %ret -} - -define i1 @test_various_types(i256 %int, float %float, <2 x i64> %vec, {i32, i32} %struct, [2 x i64] %arr, i64* %ptr) #0 { -; CHECK-LABEL: @test_various_types( -; CHECK: llvm.is.constant -; CHECK: llvm.is.constant -; CHECK: llvm.is.constant -; CHECK: llvm.is.constant -; CHECK: llvm.is.constant -; CHECK: llvm.is.constant -; CHECK-NOT: llvm.is.constant - %v1 = call i1 @llvm.is.constant.i256(i256 %int) - %v2 = call i1 @llvm.is.constant.f32(float %float) - %v3 = call i1 @llvm.is.constant.v2i64(<2 x i64> %vec) - %v4 = call i1 @llvm.is.constant.sl_i32i32s({i32, i32} %struct) - %v5 = call i1 @llvm.is.constant.a2i64([2 x i64] %arr) - %v6 = call i1 @llvm.is.constant.p0i64(i64* %ptr) - - %c1 = call i1 @llvm.is.constant.i256(i256 -1) - %c2 = call i1 @llvm.is.constant.f32(float 17.0) - %c3 = call i1 @llvm.is.constant.v2i64(<2 x i64> <i64 -1, i64 44>) - %c4 = call i1 @llvm.is.constant.sl_i32i32s({i32, i32} {i32 -1, i32 32}) - %c5 = call i1 @llvm.is.constant.a2i64([2 x i64] [i64 -1, i64 32]) - %c6 = call i1 @llvm.is.constant.p0i64(i64* inttoptr (i32 42 to i64*)) - - %x1 = add i1 %v1, %c1 - %x2 = add i1 %v2, %c2 - %x3 = add i1 %v3, %c3 - %x4 = add i1 %v4, %c4 - %x5 = add i1 %v5, %c5 - %x6 = add i1 %v6, %c6 - - %res2 = add i1 %x1, %x2 - %res3 = add i1 %res2, %x3 - %res4 = add i1 %res3, %x4 - %res5 = add i1 %res4, %x5 - %res6 = add i1 %res5, %x6 - - ret i1 %res6 -} - -define i1 @test_various_types2() #0 { -; CHECK-LABEL: @test_various_types2( -; CHECK: ret i1 false - %r = call i1 @test_various_types(i256 -1, float 22.0, <2 x i64> <i64 -1, i64 44>, - {i32, i32} {i32 -1, i32 55}, [2 x i64] [i64 -1, i64 55], - i64* inttoptr (i64 42 to i64*)) - ret i1 %r -} - -attributes #0 = { nounwind uwtable } diff --git a/llvm/test/CodeGen/X86/O0-pipeline.ll b/llvm/test/CodeGen/X86/O0-pipeline.ll index 271aec5fa05..b6e1e459c2d 100644 --- a/llvm/test/CodeGen/X86/O0-pipeline.ll +++ b/llvm/test/CodeGen/X86/O0-pipeline.ll @@ -24,6 +24,7 @@ ; CHECK-NEXT: Module Verifier ; CHECK-NEXT: Lower Garbage Collection Instructions ; CHECK-NEXT: Shadow Stack GC Lowering +; CHECK-NEXT: Lower constant intrinsics ; CHECK-NEXT: Remove unreachable blocks from the CFG ; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (post inlining) ; CHECK-NEXT: Scalarize Masked Memory Intrinsics diff --git a/llvm/test/CodeGen/X86/O3-pipeline.ll b/llvm/test/CodeGen/X86/O3-pipeline.ll index d7569ccb2da..389c21f0a8f 100644 --- a/llvm/test/CodeGen/X86/O3-pipeline.ll +++ b/llvm/test/CodeGen/X86/O3-pipeline.ll @@ -35,6 +35,7 @@ ; CHECK-NEXT: Expand memcmp() to load/stores ; CHECK-NEXT: Lower Garbage Collection Instructions ; CHECK-NEXT: Shadow Stack GC Lowering +; CHECK-NEXT: Lower constant intrinsics ; CHECK-NEXT: Remove unreachable blocks from the CFG ; CHECK-NEXT: Dominator Tree Construction ; CHECK-NEXT: Natural Loop Information diff --git a/llvm/test/CodeGen/X86/is-constant.ll b/llvm/test/CodeGen/X86/is-constant.ll deleted file mode 100644 index b4c1f351a2a..00000000000 --- a/llvm/test/CodeGen/X86/is-constant.ll +++ /dev/null @@ -1,50 +0,0 @@ -; RUN: llc -O2 < %s | FileCheck %s --check-prefix=CHECK-O2 --check-prefix=CHECK -; RUN: llc -O0 -fast-isel < %s | FileCheck %s --check-prefix=CHECK-O0 --check-prefix=CHECK -; RUN: llc -O0 -fast-isel=0 < %s | FileCheck %s --check-prefix=CHECK-O0 --check-prefix=CHECK -; RUN: llc -O0 -global-isel < %s | FileCheck %s --check-prefix=CHECK-O0 --check-prefix=CHECK - -;; Ensure that an unfoldable is.constant gets lowered reasonably in -;; optimized codegen, in particular, that the "true" branch is -;; eliminated. -;; -;; This isn't asserting any specific output from non-optimized runs, -;; (e.g., currently the not-taken branch does not get eliminated). But -;; it does ensure that lowering succeeds in all 3 codegen paths. - -target triple = "x86_64-unknown-linux-gnu" - -declare i1 @llvm.is.constant.i32(i32 %a) nounwind readnone -declare i1 @llvm.is.constant.i64(i64 %a) nounwind readnone -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1, i1) nounwind readnone - -declare i32 @subfun_1() -declare i32 @subfun_2() - -define i32 @test_branch(i32 %in) nounwind { -; CHECK-LABEL: test_branch: -; CHECK-O2: %bb.0: -; CHECK-O2-NEXT: jmp subfun_2 - %v = call i1 @llvm.is.constant.i32(i32 %in) - br i1 %v, label %True, label %False - -True: - %call1 = tail call i32 @subfun_1() - ret i32 %call1 - -False: - %call2 = tail call i32 @subfun_2() - ret i32 %call2 -} - -;; llvm.objectsize is another tricky case which gets folded to -1 very -;; late in the game. We'd like to ensure that llvm.is.constant of -;; llvm.objectsize is true. -define i1 @test_objectsize(i8* %obj) nounwind { -; CHECK-LABEL: test_objectsize: -; CHECK-O2: %bb.0: -; CHECK-O2: movb $1, %al -; CHECK-O2-NEXT: retq - %os = call i64 @llvm.objectsize.i64.p0i8(i8* %obj, i1 false, i1 false, i1 false) - %v = call i1 @llvm.is.constant.i64(i64 %os) - ret i1 %v -} diff --git a/llvm/test/CodeGen/X86/object-size.ll b/llvm/test/CodeGen/X86/object-size.ll deleted file mode 100644 index b795e0fda8b..00000000000 --- a/llvm/test/CodeGen/X86/object-size.ll +++ /dev/null @@ -1,55 +0,0 @@ -; RUN: llc -O0 < %s | FileCheck %s - -; ModuleID = 'ts.c' -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" -target triple = "x86_64-apple-darwin10.0" - -@p = common global i8* null, align 8 ; <i8**> [#uses=4] -@.str = private constant [3 x i8] c"Hi\00" ; <[3 x i8]*> [#uses=1] - -define void @bar() nounwind ssp { -entry: - %tmp = load i8*, i8** @p ; <i8*> [#uses=1] - %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp, i1 0) ; <i64> [#uses=1] - %cmp = icmp ne i64 %0, -1 ; <i1> [#uses=1] -; CHECK: movq $-1, [[RAX:%r..]] -; CHECK: cmpq $-1, [[RAX]] - br i1 %cmp, label %cond.true, label %cond.false - -cond.true: ; preds = %entry - %tmp1 = load i8*, i8** @p ; <i8*> [#uses=1] - %tmp2 = load i8*, i8** @p ; <i8*> [#uses=1] - %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp2, i1 1) ; <i64> [#uses=1] - %call = call i8* @__strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i64 %1) ssp ; <i8*> [#uses=1] - br label %cond.end - -cond.false: ; preds = %entry - %tmp3 = load i8*, i8** @p ; <i8*> [#uses=1] - %call4 = call i8* @__inline_strcpy_chk(i8* %tmp3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0)) ssp ; <i8*> [#uses=1] - br label %cond.end - -cond.end: ; preds = %cond.false, %cond.true - %cond = phi i8* [ %call, %cond.true ], [ %call4, %cond.false ] ; <i8*> [#uses=0] - ret void -} - -declare i64 @llvm.objectsize.i64.p0i8(i8*, i1) nounwind readonly - -declare i8* @__strcpy_chk(i8*, i8*, i64) ssp - -define internal i8* @__inline_strcpy_chk(i8* %__dest, i8* %__src) nounwind ssp { -entry: - %retval = alloca i8* ; <i8**> [#uses=2] - %__dest.addr = alloca i8* ; <i8**> [#uses=3] - %__src.addr = alloca i8* ; <i8**> [#uses=2] - store i8* %__dest, i8** %__dest.addr - store i8* %__src, i8** %__src.addr - %tmp = load i8*, i8** %__dest.addr ; <i8*> [#uses=1] - %tmp1 = load i8*, i8** %__src.addr ; <i8*> [#uses=1] - %tmp2 = load i8*, i8** %__dest.addr ; <i8*> [#uses=1] - %0 = call i64 @llvm.objectsize.i64.p0i8(i8* %tmp2, i1 1) ; <i64> [#uses=1] - %call = call i8* @__strcpy_chk(i8* %tmp, i8* %tmp1, i64 %0) ssp ; <i8*> [#uses=1] - store i8* %call, i8** %retval - %1 = load i8*, i8** %retval ; <i8*> [#uses=1] - ret i8* %1 -} |