diff options
| author | Serguei Katkov <serguei.katkov@azul.com> | 2017-11-20 05:42:36 +0000 |
|---|---|---|
| committer | Serguei Katkov <serguei.katkov@azul.com> | 2017-11-20 05:42:36 +0000 |
| commit | 505359f705797548419bba8a849644db037bc027 (patch) | |
| tree | 7f0aa3b6fa61fbec48929a382d185719019df252 /llvm/test/Transforms | |
| parent | 8e820552c387f46b2bbd6d51f3f7975e8d17fdb9 (diff) | |
| download | bcm5719-llvm-505359f705797548419bba8a849644db037bc027.tar.gz bcm5719-llvm-505359f705797548419bba8a849644db037bc027.zip | |
[CGP] Fix the crash caused by enable of complex addr mode
We must collect all AddModes even if they are the same.
This is due to Original value is different but we need all original
values collected as they are used as anchors in common phi finding.
Reviewers: john.brawn, reames
Reviewed By: john.brawn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D40166
llvm-svn: 318638
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-base.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-base.ll b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-base.ll index 2bacbdd7f40..f56f99c551d 100644 --- a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-base.ll +++ b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-base.ll @@ -473,3 +473,38 @@ fallthrough: %v = load i64 , i64* %p1, align 8 ret i64 %v } + +; The same two addr modes by different paths +define i32 @test18(i1 %cond1, i1 %cond2, i64* %b1, i64* %b2) { +; CHECK-LABEL: @test18 +entry: + %g1 = getelementptr inbounds i64, i64* %b2, i64 5 + %bc1 = bitcast i64* %g1 to i32* + br i1 %cond1, label %if.then1, label %if.then2 + +if.then1: + %g2 = getelementptr inbounds i64, i64* %b1, i64 5 + %bc2 = bitcast i64* %g2 to i32* + br label %fallthrough + +if.then2: + %bc1_1 = bitcast i64* %g1 to i32* + br i1 %cond2, label %fallthrough, label %if.then3 + +if.then3: + %bc1_2 = bitcast i64* %g1 to i32* + br label %fallthrough + +fallthrough: +; CHECK-YES: sunk_phi +; CHECK-NO-LABEL: fallthrough: +; CHECK-NO: phi +; CHECK-NO-NEXT: load + %c = phi i32* [%bc2, %if.then1], [%bc1_1, %if.then2], [%bc1_2, %if.then3] + %v1 = load i32, i32* %c, align 4 + %g1_1 = getelementptr inbounds i64, i64* %b2, i64 5 + %bc1_1_1 = bitcast i64* %g1_1 to i32* + %v2 = load i32, i32* %bc1_1_1, align 4 + %v = add i32 %v1, %v2 + ret i32 %v +} |

