Skip to content

Commit

Permalink
[ConstantFolding] Avoid use of ConstantExpr::getOr() (NFC)
Browse files Browse the repository at this point in the history
Constant folding cannot fail here, because we're really working
on plain integers. It might be better to make all of this work
on APInts instead of Constants.
  • Loading branch information
nikic committed Jul 24, 2023
1 parent 57329ca commit a1403dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/lib/Analysis/ConstantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) {
ShiftAmt += isLittleEndian ? SrcBitSize : -SrcBitSize;

// Mix it in.
Elt = ConstantExpr::getOr(Elt, Src);
Elt = ConstantFoldBinaryOpOperands(Instruction::Or, Elt, Src, DL);
assert(Elt && "Constant folding cannot fail on plain integers");
}
Result.push_back(Elt);
}
Expand Down

0 comments on commit a1403dc

Please sign in to comment.