[PATCH] D94380: [InstCombine] Update transformations to use poison for insertelement/shufflevector's placeholder value (1/2)
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 10 17:33:04 PST 2021
aqjune added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1728
// Vec.
if (IdxN % DstNumElts != 0 || IdxN + DstNumElts > VecNumElts) {
replaceInstUsesWith(CI, UndefValue::get(CI.getType()));
----------------
Guarded by this branch condition, the for loop at line 1740 never adds a mask that makes `Shuffle` point to the second operand vector (which was previously Undef, but now Poison).
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2613
- return InsertElementInst::Create(UndefValue::get(DestTy), Elem,
- Constant::getNullValue(Type::getInt32Ty(CI.getContext())));
}
----------------
This creates `insertelement <1 x X86_mmx> undef, Elem, 0`
Replacing undef with poison has no visible effect.
================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1693
Value *NewRHS = ConstOp1 ? NewC : V1;
- return createBinOpShuffle(NewLHS, NewRHS, Mask);
+ return createBinOpShuffle(NewLHS, NewRHS, Mask, false);
}
----------------
Be conservative, and create shufflevector with undef if Mask may point to the second vector
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94380/new/
https://reviews.llvm.org/D94380
More information about the llvm-commits
mailing list