diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-08-24 16:35:02 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-08-24 16:35:02 +0000 |
commit | 5e529592b17880abebd71c233b1cb848c32abeb6 (patch) | |
tree | 5d10efe4faeda81dd82278472bb9c2c09b8196e4 /test/Transforms | |
parent | 15c5c77fa04cd97e1057e8a585f669fc49da0d92 (diff) |
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/Inline/recursive.ll | 31 | ||||
-rw-r--r-- | test/Transforms/LowerAtomic/atomic-swap.ll | 11 | ||||
-rw-r--r-- | test/Transforms/Reassociate/canonicalize-neg-const.ll | 22 |
3 files changed, 64 insertions, 0 deletions
diff --git a/test/Transforms/Inline/recursive.ll b/test/Transforms/Inline/recursive.ll index e189339e224b..ded12dddf63f 100644 --- a/test/Transforms/Inline/recursive.ll +++ b/test/Transforms/Inline/recursive.ll @@ -37,3 +37,34 @@ declare void @foo2(i8* %in) declare i32 @foo(i32 %param) +; Check that when inlining a non-recursive path into a function's own body that +; we get the re-mapping of instructions correct. +define i32 @test_recursive_inlining_remapping(i1 %init, i8* %addr) { +; CHECK-LABEL: define i32 @test_recursive_inlining_remapping( +bb: + %n = alloca i32 + br i1 %init, label %store, label %load +; CHECK-NOT: alloca +; +; CHECK: %[[N:.*]] = alloca i32 +; CHECK-NEXT: br i1 %init, + +store: + store i32 0, i32* %n + %cast = bitcast i32* %n to i8* + %v = call i32 @test_recursive_inlining_remapping(i1 false, i8* %cast) + ret i32 %v +; CHECK-NOT: call +; +; CHECK: store i32 0, i32* %[[N]] +; CHECK-NEXT: %[[CAST:.*]] = bitcast i32* %[[N]] to i8* +; CHECK-NEXT: %[[INLINED_LOAD:.*]] = load i32, i32* %[[N]] +; CHECK-NEXT: ret i32 %[[INLINED_LOAD]] +; +; CHECK-NOT: call + +load: + %castback = bitcast i8* %addr to i32* + %n.load = load i32, i32* %castback + ret i32 %n.load +} diff --git a/test/Transforms/LowerAtomic/atomic-swap.ll b/test/Transforms/LowerAtomic/atomic-swap.ll index 77000527a11f..59a5caed481c 100644 --- a/test/Transforms/LowerAtomic/atomic-swap.ll +++ b/test/Transforms/LowerAtomic/atomic-swap.ll @@ -26,3 +26,14 @@ define i8 @swap() { ret i8 %j ; CHECK: ret i8 [[INST]] } + + +define i8 @swap_optnone() noinline optnone { +; CHECK-LABEL: @swap_optnone( + %i = alloca i8 + %j = atomicrmw xchg i8* %i, i8 42 monotonic +; CHECK: [[INST:%[a-z0-9]+]] = load +; CHECK-NEXT: store + ret i8 %j +; CHECK: ret i8 [[INST]] +} diff --git a/test/Transforms/Reassociate/canonicalize-neg-const.ll b/test/Transforms/Reassociate/canonicalize-neg-const.ll index 465460cb53b1..7cb2c3a10e2d 100644 --- a/test/Transforms/Reassociate/canonicalize-neg-const.ll +++ b/test/Transforms/Reassociate/canonicalize-neg-const.ll @@ -154,3 +154,25 @@ define i4 @test13(i4 %x) { %add = add i4 %mul, 3 ret i4 %add } + +; This tests used to cause an infinite loop where we would loop between +; canonicalizing the negated constant (i.e., (X + Y*-5.0) -> (X - Y*5.0)) and +; breaking up a subtract (i.e., (X - Y*5.0) -> X + (0 - Y*5.0)). To break the +; cycle, we don't canonicalize the negative constant if we're going to later +; break up the subtract. +; +; Check to make sure we don't canonicalize +; (%pow2*-5.0 + %sub) -> (%sub - %pow2*5.0) +; as we would later break up this subtract causing a cycle. +; +; CHECK-LABEL: @pr34078 +; CHECK: %mul5.neg = fmul fast double %pow2, -5.000000e-01 +; CHECK: %sub1 = fadd fast double %mul5.neg, %sub +define double @pr34078(double %A) { + %sub = fsub fast double 1.000000e+00, %A + %pow2 = fmul double %A, %A + %mul5 = fmul fast double %pow2, 5.000000e-01 + %sub1 = fsub fast double %sub, %mul5 + %add = fadd fast double %sub1, %sub1 + ret double %add +} |