summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoadCombine
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2017-02-09 21:46:49 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2017-02-09 21:46:49 +0000
commit714d9d22ad7bd19679a042239b9e384d38303610 (patch)
treede174277a5036118fbc2fd14edc7d0b8d6676bb4 /llvm/test/Transforms/LoadCombine
parent857aba44106ac543cbd8210cff56db46e7287c84 (diff)
downloadbcm5719-llvm-714d9d22ad7bd19679a042239b9e384d38303610.tar.gz
bcm5719-llvm-714d9d22ad7bd19679a042239b9e384d38303610.zip
[LoadCombine] Fix combining of loads which span an aliasing store.
Fixes PR31517 Differential Revision: https://reviews.llvm.org/D28922 llvm-svn: 294632
Diffstat (limited to 'llvm/test/Transforms/LoadCombine')
-rw-r--r--llvm/test/Transforms/LoadCombine/load-combine-aa.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoadCombine/load-combine-aa.ll b/llvm/test/Transforms/LoadCombine/load-combine-aa.ll
index fc639c0bc05..ad66a1a6387 100644
--- a/llvm/test/Transforms/LoadCombine/load-combine-aa.ll
+++ b/llvm/test/Transforms/LoadCombine/load-combine-aa.ll
@@ -37,3 +37,24 @@ define i64 @test2(i32* nocapture readonly %a, i32* nocapture readonly %b) {
ret i64 %add
}
+%rec11 = type { i16, i16, i16 }
+@str = global %rec11 { i16 1, i16 2, i16 3 }
+
+; PR31517 - Check that loads which span an aliasing store are not combined.
+define i16 @test3() {
+; CHECK-LABEL: @test3
+
+; CHECK: load i16, i16*
+; CHECK: store i16
+; CHECK: ret i16
+
+ %_tmp9 = getelementptr %rec11, %rec11* @str, i16 0, i32 1
+ %_tmp10 = load i16, i16* %_tmp9
+ %_tmp12 = getelementptr %rec11, %rec11* @str, i16 0, i32 0
+ store i16 %_tmp10, i16* %_tmp12
+ %_tmp13 = getelementptr %rec11, %rec11* @str, i16 0, i32 0
+ %_tmp14 = load i16, i16* %_tmp13
+ %_tmp15 = icmp eq i16 %_tmp14, 3
+ %_tmp16 = select i1 %_tmp15, i16 1, i16 0
+ ret i16 %_tmp16
+}
OpenPOWER on IntegriCloud