[llvm] [InstCombine][VectorCombine][NFC] Unify uses of lossless inverse cast (PR #156597)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 3 03:52:18 PDT 2025
================
@@ -1799,16 +1799,19 @@ static Instruction *foldLogicCastConstant(BinaryOperator &Logic, CastInst *Cast,
// type may provide more information to later folds, and the smaller logic
// instruction may be cheaper (particularly in the case of vectors).
Value *X;
+ auto &DL = IC.getDataLayout();
if (match(Cast, m_OneUse(m_ZExt(m_Value(X))))) {
- if (Constant *TruncC = IC.getLosslessUnsignedTrunc(C, SrcTy)) {
+ if (Constant *TruncC =
+ getLosslessInvCast(C, SrcTy, Instruction::ZExt, DL)) {
----------------
RKSimon wrote:
Its messy, but we could keep the getLosslessUnsignedTrunc/getLosslessSignedTrunc function names and change them to wrappers for getLosslessInvCast?
https://github.com/llvm/llvm-project/pull/156597
More information about the llvm-commits
mailing list