summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-09-16 18:28:33 +0000
committerOwen Anderson <resistor@mac.com>2010-09-16 18:28:33 +0000
commitc2ce21ad51590377b572a572243e373f7a7b9fb4 (patch)
treee1648b926976b1bda2137558aada313284d2dda3 /test
parent6dbe29e34e0017dac703f951429964d9c95b528c (diff)
downloadllvm-c2ce21ad51590377b572a572243e373f7a7b9fb4.tar.gz
llvm-c2ce21ad51590377b572a572243e373f7a7b9fb4.tar.bz2
llvm-c2ce21ad51590377b572a572243e373f7a7b9fb4.tar.xz
It is possible, under specific circumstances involving ptrtoint ConstantExpr's, for LVI to end up trying to merge
a Constant into a ConstantRange. Handle this conservatively for now, rather than asserting. The testcase is more complex that I would like, but the manifestation of the problem is sensitive to iteration orders and the state of the LVI cache, and I have not been able to reproduce it with manually constructed or simplified cases. Fixes PR8162. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll84
1 files changed, 84 insertions, 0 deletions
diff --git a/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll b/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll
new file mode 100644
index 0000000000..bc4e921ccc
--- /dev/null
+++ b/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll
@@ -0,0 +1,84 @@
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin11.0.0"
+
+%struct.S2 = type {}
+
+@g_128 = external global %struct.S2, align 1
+@g_106 = external global i16, align 2
+
+define void @int328(i16 signext %p_82) noreturn nounwind ssp {
+entry:
+ %tobool3 = icmp eq i16 %p_82, 0
+ br label %for.cond.outer
+
+for.cond.outer: ; preds = %for.cond.loopexit, %entry
+ br label %for.cond
+
+for.cond.loopexit: ; preds = %bb.nph, %for.cond9.preheader
+ br label %for.cond.outer
+
+for.cond.loopexit4.us-lcssa: ; preds = %if.then
+ br label %for.cond.loopexit4
+
+for.cond.loopexit4: ; preds = %for.cond.loopexit4.us-lcssa.us, %for.cond.loopexit4.us-lcssa
+ br label %for.cond.backedge
+
+for.cond: ; preds = %for.cond.backedge, %for.cond.outer
+ br i1 %tobool3, label %for.cond.split.us, label %for.cond.for.cond.split_crit_edge
+
+for.cond.for.cond.split_crit_edge: ; preds = %for.cond
+ br label %lbl_133
+
+for.cond.split.us: ; preds = %for.cond
+ br label %lbl_133.us
+
+lbl_133.us: ; preds = %lbl_134.us, %for.cond.split.us
+ br i1 undef, label %if.else14.us-lcssa.us, label %if.then.us
+
+lbl_134.us: ; preds = %if.then.us
+ br i1 icmp eq (i16 ptrtoint (%struct.S2* @g_128 to i16), i16 0), label %for.cond9.preheader.us-lcssa.us, label %lbl_133.us
+
+if.then.us: ; preds = %lbl_133.us
+ br i1 true, label %for.cond.loopexit4.us-lcssa.us, label %lbl_134.us
+
+if.else14.us-lcssa.us: ; preds = %lbl_133.us
+ br label %if.else14
+
+for.cond9.preheader.us-lcssa.us: ; preds = %lbl_134.us
+ br label %for.cond9.preheader
+
+for.cond.loopexit4.us-lcssa.us: ; preds = %if.then.us
+ br label %for.cond.loopexit4
+
+lbl_133: ; preds = %lbl_134, %for.cond.for.cond.split_crit_edge
+ %l_109.0 = phi i16 [ 0, %for.cond.for.cond.split_crit_edge ], [ ptrtoint (%struct.S2* @g_128 to i16), %lbl_134 ]
+ %tobool = icmp eq i32 undef, 0
+ br i1 %tobool, label %if.else14.us-lcssa, label %if.then
+
+if.then: ; preds = %lbl_133
+ br i1 false, label %for.cond.loopexit4.us-lcssa, label %lbl_134
+
+lbl_134: ; preds = %if.then
+ br i1 icmp eq (i16 ptrtoint (%struct.S2* @g_128 to i16), i16 0), label %for.cond9.preheader.us-lcssa, label %lbl_133
+
+for.cond9.preheader.us-lcssa: ; preds = %lbl_134
+ br label %for.cond9.preheader
+
+for.cond9.preheader: ; preds = %for.cond9.preheader.us-lcssa, %for.cond9.preheader.us-lcssa.us
+ br i1 undef, label %bb.nph, label %for.cond.loopexit
+
+bb.nph: ; preds = %for.cond9.preheader
+ br label %for.cond.loopexit
+
+if.else14.us-lcssa: ; preds = %lbl_133
+ br label %if.else14
+
+if.else14: ; preds = %if.else14.us-lcssa, %if.else14.us-lcssa.us
+ %l_109.0.lcssa = phi i16 [ %l_109.0, %if.else14.us-lcssa ], [ 0, %if.else14.us-lcssa.us ]
+ store i16 undef, i16* @g_106, align 2
+ br label %for.cond.backedge
+
+for.cond.backedge: ; preds = %if.else14, %for.cond.loopexit4
+ br label %for.cond
+}