diff options
| author | James Molloy <james.molloy@arm.com> | 2016-09-11 09:00:03 +0000 |
|---|---|---|
| committer | James Molloy <james.molloy@arm.com> | 2016-09-11 09:00:03 +0000 |
| commit | 104370ab37b6b6fb4d35fcd86a52f3c77af4cd20 (patch) | |
| tree | 272f72063cac6d81636234004ec43e71215cc66c /llvm/test/Transforms | |
| parent | 3e1ce05752101ed7e1903294de2a3638e5036a63 (diff) | |
| download | bcm5719-llvm-104370ab37b6b6fb4d35fcd86a52f3c77af4cd20.tar.gz bcm5719-llvm-104370ab37b6b6fb4d35fcd86a52f3c77af4cd20.zip | |
[SimplifyCFG] Be even more conservative in SinkThenElseCodeToEnd
This should *actually* fix PR30244. This cranks up the workaround for PR30188 so that we never sink loads or stores of allocas.
The idea is that these should be removed by SROA/Mem2Reg, and any movement of them may well confuse SROA or just cause unwanted code churn. It's not ideal that the midend should be crippled like this, but that unwanted churn can really cause significant regressions in important workloads (tsan).
llvm-svn: 281162
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/SimplifyCFG/inline-asm-sink.ll | 4 | ||||
| -rw-r--r-- | llvm/test/Transforms/SimplifyCFG/sink-common-code.ll | 35 |
2 files changed, 25 insertions, 14 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/inline-asm-sink.ll b/llvm/test/Transforms/SimplifyCFG/inline-asm-sink.ll index 7fbaa735059..9dd04a23e36 100644 --- a/llvm/test/Transforms/SimplifyCFG/inline-asm-sink.ll +++ b/llvm/test/Transforms/SimplifyCFG/inline-asm-sink.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -simplifycfg -S | FileCheck %s +; RUN: opt < %s -mem2reg -simplifycfg -S | FileCheck %s define i32 @test(i32 %x) { ; CHECK-LABEL: @test @@ -23,7 +23,7 @@ if.else: if.end: ; CHECK-LABEL: if.end: -; CHECK: {{%.*}} = phi i32 [ [[ASM2]], %if.else ], [ [[ASM1]], %if.then ] +; CHECK: {{%.*}} = phi i32 [ [[ASM1]], %if.then ], [ [[ASM2]], %if.else ] %tmp3 = load i32, i32* %y, align 4 ret i32 %tmp3 } diff --git a/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll b/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll index c75d2c18aca..e944a9bc1e9 100644 --- a/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll +++ b/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll @@ -669,24 +669,35 @@ declare void @g() ; CHECK-LABEL: test_pr30292 ; CHECK: phi i32 [ 0, %entry ], [ %add1, %succ ], [ %add2, %two ] -define void @test_pr30244(i1 %cond, i1 %cond2, i32 %a, i32 %b) { +define zeroext i1 @test_pr30244(i1 zeroext %flag, i1 zeroext %flag2, i32 %blksA, i32 %blksB, i32 %nblks) { + entry: - %add1 = add i32 %a, 1 - br label %succ + %p = alloca i8 + br i1 %flag, label %if.then, label %if.else -one: - br i1 %cond, label %two, label %succ +if.then: + %cmp = icmp uge i32 %blksA, %nblks + %frombool1 = zext i1 %cmp to i8 + store i8 %frombool1, i8* %p + br label %if.end -two: - call void @g() - %add2 = add i32 %a, 1 - br label %succ +if.else: + br i1 %flag2, label %if.then2, label %if.end -succ: - %p = phi i32 [ 0, %entry ], [ %add1, %one ], [ %add2, %two ] - br label %one +if.then2: + %add = add i32 %nblks, %blksB + %cmp2 = icmp ule i32 %add, %blksA + %frombool3 = zext i1 %cmp2 to i8 + store i8 %frombool3, i8* %p + br label %if.end + +if.end: + ret i1 true } +; CHECK-LABEL: @test_pr30244 +; CHECK: store +; CHECK: store ; CHECK: !0 = !{!1, !1, i64 0} ; CHECK: !1 = !{!"float", !2} |

