llvm.org GIT mirror llvm / 24d616e
Merging r168921: into the 3.2 release branch. Follow up to 168711: It's safe to base this analysis on the found compare, just return the value for the right predicate. Thanks to Andy for catching this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168974 91177308-0d34-0410-b5e6-96231b3b80d8 Pawel Wodnicki 6 years ago
2 changed file(s) with 52 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
61486148 if (SimplifyICmpOperands(Pred, LHS, RHS))
61496149 if (LHS == RHS)
61506150 return CmpInst::isTrueWhenEqual(Pred);
6151
6152 // Canonicalize the found cond too. We can't conclude a result from the
6153 // simplified values.
6154 SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS);
6151 if (SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS))
6152 if (FoundLHS == FoundRHS)
6153 return CmpInst::isFalseWhenEqual(FoundPred);
61556154
61566155 // Check to see if we can make the LHS or RHS match.
61576156 if (LHS == FoundRHS || RHS == FoundLHS) {
159159 }
160160
161161 declare void @llvm.trap() noreturn nounwind
162
163 ; In this case the second loop only has a single iteration, fold the header away
164 ; CHECK: @func_12
165 ; CHECK: %tmp5 = icmp slt i32 %__key6.0, 10
166 ; CHECK: br i1 true, label %noassert68, label %unrolledend
167 define i32 @func_12() nounwind uwtable {
168 entry:
169 br label %forcond
170
171 forcond: ; preds = %noassert, %entry
172 %__key6.0 = phi i32 [ 2, %entry ], [ %tmp37, %noassert ]
173 %tmp5 = icmp slt i32 %__key6.0, 10
174 br i1 %tmp5, label %noassert, label %forcond38.preheader
175
176 forcond38.preheader: ; preds = %forcond
177 br label %forcond38
178
179 noassert: ; preds = %forbody
180 %tmp13 = sdiv i32 -32768, %__key6.0
181 %tmp2936 = shl i32 %tmp13, 24
182 %sext23 = shl i32 %tmp13, 24
183 %tmp32 = icmp eq i32 %tmp2936, %sext23
184 %tmp37 = add i32 %__key6.0, 1
185 br i1 %tmp32, label %forcond, label %assert33
186
187 assert33: ; preds = %noassert
188 tail call void @llvm.trap()
189 unreachable
190
191 forcond38: ; preds = %noassert68, %forcond38.preheader
192 %__key8.0 = phi i32 [ %tmp81, %noassert68 ], [ 2, %forcond38.preheader ]
193 %tmp46 = icmp slt i32 %__key8.0, 10
194 br i1 %tmp46, label %noassert68, label %unrolledend
195
196 noassert68: ; preds = %forbody39
197 %tmp57 = sdiv i32 -32768, %__key8.0
198 %sext34 = shl i32 %tmp57, 16
199 %sext21 = shl i32 %tmp57, 16
200 %tmp76 = icmp ne i32 %sext34, %sext21
201 %tmp81 = add i32 %__key8.0, 1
202 br i1 %tmp76, label %forcond38, label %assert77
203
204 assert77: ; preds = %noassert68
205 tail call void @llvm.trap()
206 unreachable
207
208 unrolledend: ; preds = %forcond38
209 ret i32 0
210 }