[llvm] [SLP] Match poison as instruction with the same opcode (PR #115946)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 12 17:24:24 PST 2024
================
@@ -940,8 +952,17 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
if (!isTriviallyVectorizable(BaseID) && BaseMappings.empty())
return InstructionsState::invalid();
}
+ bool AnyPoison = InstCnt != VL.size();
for (int Cnt = 0, E = VL.size(); Cnt < E; Cnt++) {
- auto *I = cast<Instruction>(VL[Cnt]);
+ auto *I = dyn_cast<Instruction>(VL[Cnt]);
+ if (!I)
+ continue;
+
+ // Cannot combine poison and divisions.
+ if (AnyPoison && (I->isIntDivRem() || I->isArithmeticShift() ||
----------------
dtcxzyw wrote:
AShr is cheap and it doesn't cause immediate UB.
https://github.com/llvm/llvm-project/pull/115946
More information about the llvm-commits
mailing list