mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Reapply r237520 with another fix for infinite looping
SimplifyDemandedBits was "simplifying" a constant by removing just sign bits. This caused a canonicalization race between different parts of instcombine. Fix and regression test added - third time lucky? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "InstCombineInternal.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/PatternMatch.h"
|
||||
|
||||
@@ -406,6 +407,12 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
|
||||
break;
|
||||
}
|
||||
case Instruction::Select:
|
||||
// If this is a select as part of a min/max pattern, don't simplify any
|
||||
// further in case we break the structure.
|
||||
Value *LHS, *RHS;
|
||||
if (matchSelectPattern(I, LHS, RHS) != SPF_UNKNOWN)
|
||||
return nullptr;
|
||||
|
||||
if (SimplifyDemandedBits(I->getOperandUse(2), DemandedMask, RHSKnownZero,
|
||||
RHSKnownOne, Depth + 1) ||
|
||||
SimplifyDemandedBits(I->getOperandUse(1), DemandedMask, LHSKnownZero,
|
||||
|
Reference in New Issue
Block a user