summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-02-08 14:52:40 +0000
committerSanjay Patel <spatel@rotateright.com>2018-02-08 14:52:40 +0000
commita60aec1ab72ab5df8c72d8c0cb37b823b0b28b7c (patch)
treeb43a4772b959ab175f41a54bbf4a4d5b6597e662 /llvm/test
parent2583976e81268250bd53aaaa5914242aaa267bc4 (diff)
downloadbcm5719-llvm-a60aec1ab72ab5df8c72d8c0cb37b823b0b28b7c.tar.gz
bcm5719-llvm-a60aec1ab72ab5df8c72d8c0cb37b823b0b28b7c.zip
[ValueTracking] don't crash when assumptions conflict (PR36270)
The last assume in the test says that %B12 is 0. The first assume says that %and1 is less than %B12. Therefore, %and1 is unsigned less than 0...does not compute. That means this line: Known.Zero.setHighBits(RHSKnown.countMinLeadingZeros() + 1); ...tries to set more bits than exist. Differential Revision: https://reviews.llvm.org/D43052 llvm-svn: 324610
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstSimplify/assume.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/assume.ll b/llvm/test/Transforms/InstSimplify/assume.ll
index 66f2120f292..06613a4ce37 100644
--- a/llvm/test/Transforms/InstSimplify/assume.ll
+++ b/llvm/test/Transforms/InstSimplify/assume.ll
@@ -5,6 +5,7 @@
; CHECK: remark: /tmp/s.c:1:13: Detected conflicting code assumptions.
; CHECK: remark: /tmp/s.c:4:10: Detected conflicting code assumptions.
+; CHECK: remark: /tmp/s.c:5:50: Detected conflicting code assumptions.
define void @test1() {
; CHECK-LABEL: @test1(
@@ -50,6 +51,24 @@ define i8 @conflicting_assumptions(i8 %x) !dbg !10 {
ret i8 %add
}
+; Another case of conflicting assumptions. This would crash because we'd
+; try to set more known bits than existed in the known bits struct.
+
+define void @PR36270(i32 %b) !dbg !13 {
+; CHECK-LABEL: @PR36270(
+; CHECK-NEXT: tail call void @llvm.assume(i1 false)
+; CHECK-NEXT: unreachable
+;
+ %B7 = xor i32 -1, 2147483647
+ %and1 = and i32 %b, 3
+ %B12 = lshr i32 %B7, %and1, !dbg !14
+ %C1 = icmp ult i32 %and1, %B12
+ tail call void @llvm.assume(i1 %C1)
+ %cmp2 = icmp eq i32 0, %B12
+ tail call void @llvm.assume(i1 %cmp2)
+ unreachable
+}
+
declare void @llvm.assume(i1) nounwind
!llvm.dbg.cu = !{!0}
@@ -69,4 +88,6 @@ declare void @llvm.assume(i1) nounwind
!10 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, variables: !2)
!11 = !DILocation(line: 4, column: 10, scope: !10)
!12 = !DILocation(line: 4, column: 3, scope: !10)
+!13 = distinct !DISubprogram(name: "PR36270", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, variables: !2)
+!14 = !DILocation(line: 5, column: 50, scope: !13)
OpenPOWER on IntegriCloud