llvm.org GIT mirror llvm / 2fa7b48
Fix PR7755: knowing something about an inval for a pred from the LHS should disable reconsidering that pred on the RHS. However, knowing something about the pred on the RHS shouldn't disable subsequent additions on the RHS from happening. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111349 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
2 changed file(s) with 29 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
340340 else
341341 InterestingVal = ConstantInt::getFalse(I->getContext());
342342
343 SmallPtrSet LHSKnownBBs;
344
343345 // Scan for the sentinel. If we find an undef, force it to the
344346 // interesting value: x|undef -> true and x&undef -> false.
345347 for (unsigned i = 0, e = LHSVals.size(); i != e; ++i)
346348 if (LHSVals[i].first == InterestingVal || LHSVals[i].first == 0) {
347349 Result.push_back(LHSVals[i]);
348350 Result.back().first = InterestingVal;
351 LHSKnownBBs.insert(LHSVals[i].second);
349352 }
350353 for (unsigned i = 0, e = RHSVals.size(); i != e; ++i)
351354 if (RHSVals[i].first == InterestingVal || RHSVals[i].first == 0) {
352355 // If we already inferred a value for this block on the LHS, don't
353356 // re-add it.
354 bool HasValue = false;
355 for (unsigned r = 0, e = Result.size(); r != e; ++r)
356 if (Result[r].second == RHSVals[i].second) {
357 HasValue = true;
358 break;
359 }
360
361 if (!HasValue) {
357 if (!LHSKnownBBs.count(RHSVals[i].second)) {
362358 Result.push_back(RHSVals[i]);
363359 Result.back().first = InterestingVal;
364360 }
435435 ret void
436436 }
437437
438
438 ; PR7755
439 define void @test16(i1 %c, i1 %c2, i1 %c3, i1 %c4) nounwind ssp {
440 entry:
441 %cmp = icmp sgt i32 undef, 1 ; [#uses=1]
442 br i1 %c, label %land.end, label %land.rhs
443
444 land.rhs: ; preds = %entry
445 br i1 %c2, label %lor.lhs.false.i, label %land.end
446
447 lor.lhs.false.i: ; preds = %land.rhs
448 br i1 %c3, label %land.end, label %land.end
449
450 land.end:
451 %0 = phi i1 [ true, %entry ], [ false, %land.rhs ], [false, %lor.lhs.false.i], [false, %lor.lhs.false.i] ; [#uses=1]
452 %cmp12 = and i1 %cmp, %0
453 %xor1 = xor i1 %cmp12, %c4
454 br i1 %xor1, label %if.then, label %if.end
455
456 if.then:
457 ret void
458
459 if.end:
460 ret void
461 }
462