summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-07-06 14:05:09 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-07-06 14:05:09 +0000
commitf4eeab452ad4093986359c78a57321df12df99b0 (patch)
tree18e20c9044ed731be0e644bf0d52fe54f4155ad1 /test
parente5a81a130f26b0b2651ad6a22e3748703b11cb46 (diff)
downloadllvm-f4eeab452ad4093986359c78a57321df12df99b0.tar.gz
llvm-f4eeab452ad4093986359c78a57321df12df99b0.tar.bz2
llvm-f4eeab452ad4093986359c78a57321df12df99b0.tar.xz
DAGCombiner: Don't drop extension behavior when shrinking a load when unsafe.
ReduceLoadWidth unconditionally drops extensions from loads. Limit it to the case when all of the bits the extension would otherwise produce are dropped by the shrink. It would be possible to shrink the load in more cases by merging the extensions, but this isn't trivial and a very rare case. I left a TODO for that case. Fixes PR16551. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/shrink-compare.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CodeGen/X86/shrink-compare.ll b/test/CodeGen/X86/shrink-compare.ll
index 83793f000d..30a5b6207d 100644
--- a/test/CodeGen/X86/shrink-compare.ll
+++ b/test/CodeGen/X86/shrink-compare.ll
@@ -66,3 +66,26 @@ lor.end: ; preds = %lor.rhs, %entry
%p = phi i1 [ true, %entry ], [ %tobool1, %lor.rhs ]
ret i1 %p
}
+
+@x = global { i8, i8, i8, i8, i8, i8, i8, i8 } { i8 1, i8 0, i8 0, i8 0, i8 1, i8 0, i8 0, i8 1 }, align 4
+
+; PR16551
+define void @test5(i32 %X) nounwind {
+entry:
+ %bf.load = load i56* bitcast ({ i8, i8, i8, i8, i8, i8, i8, i8 }* @x to i56*), align 4
+ %bf.lshr = lshr i56 %bf.load, 32
+ %bf.cast = trunc i56 %bf.lshr to i32
+ %cmp = icmp ne i32 %bf.cast, 1
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+ tail call void @bar() nounwind
+ br label %if.end
+
+if.end:
+ ret void
+
+; CHECK: test5:
+; CHECK-NOT: cmpl $1,{{.*}}x+4
+; CHECK: ret
+}