[PATCH] D112298: [InstCombine] Generalize sadd.sat combine to compute sign bits.
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 3 08:52:25 PDT 2021
dmgreen added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2324-2325
Function *F = Intrinsic::getDeclaration(MinMax1.getModule(), IntrinsicID, NewTy);
- Value *AT = Builder.CreateSExt(A, NewTy);
- Value *BT = Builder.CreateSExt(B, NewTy);
+ Value *AT = Builder.CreateTrunc(AddSub->getOperand(0), NewTy);
+ Value *BT = Builder.CreateTrunc(AddSub->getOperand(1), NewTy);
Value *Sat = Builder.CreateCall(F, {AT, BT});
----------------
lebedev.ri wrote:
> Should these not be `CreateTruncOrBitCast`?
I think CreateTrunc works how you imagine CreateTruncOrBitCast works, if everything is an integer type. It starts out with `if (V->getType() == DestTy) return V;`
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112298/new/
https://reviews.llvm.org/D112298
More information about the llvm-commits
mailing list