diff options
| author | James Molloy <james.molloy@arm.com> | 2016-09-07 08:40:20 +0000 |
|---|---|---|
| committer | James Molloy <james.molloy@arm.com> | 2016-09-07 08:40:20 +0000 |
| commit | ec905a62ae26fd3b2064a15e31b9988a8d32589a (patch) | |
| tree | 9d73c434ff1ce7cd76461d4adec25af7890c9c44 /llvm/test/Transforms | |
| parent | 42431e7ce7e41e8acf0b38465a73bebd6fd63751 (diff) | |
| download | bcm5719-llvm-ec905a62ae26fd3b2064a15e31b9988a8d32589a.tar.gz bcm5719-llvm-ec905a62ae26fd3b2064a15e31b9988a8d32589a.zip | |
[SimplifyCFG] Update workaround for PR30188 to also include loads
I should have realised this the first time around, but if we're avoiding sinking stores where the operands come from allocas so they don't create selects, we also have to do the same for loads because SROA will be just as defective looking at loads of selected addresses as stores.
Fixes PR30188 (again).
llvm-svn: 280792
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/SimplifyCFG/sink-common-code.ll | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll b/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll index 57533fa1408..b20b53cc65f 100644 --- a/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll +++ b/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll @@ -585,6 +585,35 @@ if.end: ; CHECK: store ; CHECK: store +define i32 @test_pr30188a(i1 zeroext %flag, i32 %x) { +entry: + %y = alloca i32 + %z = alloca i32 + br i1 %flag, label %if.then, label %if.else + +if.then: + call void @g() + %one = load i32, i32* %y + %two = add i32 %one, 2 + store i32 %two, i32* %y + br label %if.end + +if.else: + %three = load i32, i32* %z + %four = add i32 %three, 2 + store i32 %four, i32* %y + br label %if.end + +if.end: + ret i32 1 +} + +; CHECK-LABEL: test_pr30188a +; CHECK-NOT: select +; CHECK: load +; CHECK: load +; CHECK: store + ; The phi is confusing - both add instructions are used by it, but ; not on their respective unconditional arcs. It should not be ; optimized. |

