Skip to content

Commit 707bb42

Browse files
committed
[InstCombine] Require immediate constant in canEvaluateShifted()
Otherwise we risk infinite loops when shift constant expressions are no longer supported.
1 parent d4d2891 commit 707bb42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ static bool canEvaluateShiftedShift(unsigned OuterShAmt, bool IsOuterShl,
560560
/// this succeeds, getShiftedValue() will be called to produce the value.
561561
static bool canEvaluateShifted(Value *V, unsigned NumBits, bool IsLeftShift,
562562
InstCombinerImpl &IC, Instruction *CxtI) {
563-
// We can always evaluate constants shifted.
564-
if (isa<Constant>(V))
563+
// We can always evaluate immediate constants.
564+
if (match(V, m_ImmConstant()))
565565
return true;
566566

567567
Instruction *I = dyn_cast<Instruction>(V);

0 commit comments

Comments
 (0)