llvm.org GIT mirror llvm / 73c4842
Merging r168711: into the 3.2 release branch. SCEV: Even if the latch terminator is foldable we can't deduce the result of an unrelated condition with it. Fixes PR14432. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168973 91177308-0d34-0410-b5e6-96231b3b80d8 Pawel Wodnicki 6 years ago
2 changed file(s) with 58 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
61486148 if (SimplifyICmpOperands(Pred, LHS, RHS))
61496149 if (LHS == RHS)
61506150 return CmpInst::isTrueWhenEqual(Pred);
6151 if (SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS))
6152 if (FoundLHS == FoundRHS)
6153 return CmpInst::isFalseWhenEqual(Pred);
6151
6152 // Canonicalize the found cond too. We can't conclude a result from the
6153 // simplified values.
6154 SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS);
61546155
61556156 // Check to see if we can make the LHS or RHS match.
61566157 if (LHS == FoundRHS || RHS == FoundLHS) {
105105 return:
106106 ret void
107107 }
108
109 ; PR14432
110 ; Indvars should not turn the second loop into an infinite one.
111
112 ; CHECK: @func_11
113 ; CHECK: %tmp5 = icmp slt i32 %__key6.0, 10
114 ; CHECK-NOT: br i1 true, label %noassert68, label %unrolledend
115
116 define i32 @func_11() nounwind uwtable {
117 entry:
118 br label %forcond
119
120 forcond: ; preds = %noassert, %entry
121 %__key6.0 = phi i32 [ 2, %entry ], [ %tmp37, %noassert ]
122 %tmp5 = icmp slt i32 %__key6.0, 10
123 br i1 %tmp5, label %noassert, label %forcond38.preheader
124
125 forcond38.preheader: ; preds = %forcond
126 br label %forcond38
127
128 noassert: ; preds = %forbody
129 %tmp13 = sdiv i32 -32768, %__key6.0
130 %tmp2936 = shl i32 %tmp13, 24
131 %sext23 = shl i32 %tmp13, 24
132 %tmp32 = icmp eq i32 %tmp2936, %sext23
133 %tmp37 = add i32 %__key6.0, 1
134 br i1 %tmp32, label %forcond, label %assert33
135
136 assert33: ; preds = %noassert
137 tail call void @llvm.trap()
138 unreachable
139
140 forcond38: ; preds = %noassert68, %forcond38.preheader
141 %__key8.0 = phi i32 [ %tmp81, %noassert68 ], [ 2, %forcond38.preheader ]
142 %tmp46 = icmp slt i32 %__key8.0, 10
143 br i1 %tmp46, label %noassert68, label %unrolledend
144
145 noassert68: ; preds = %forbody39
146 %tmp57 = sdiv i32 -32768, %__key8.0
147 %sext34 = shl i32 %tmp57, 16
148 %sext21 = shl i32 %tmp57, 16
149 %tmp76 = icmp eq i32 %sext34, %sext21
150 %tmp81 = add i32 %__key8.0, 1
151 br i1 %tmp76, label %forcond38, label %assert77
152
153 assert77: ; preds = %noassert68
154 tail call void @llvm.trap()
155 unreachable
156
157 unrolledend: ; preds = %forcond38
158 ret i32 0
159 }
160
161 declare void @llvm.trap() noreturn nounwind