[llvm] [SLP] Match poison as instruction with the same opcode (PR #115946)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 09:13:45 PST 2024
================
@@ -940,8 +952,16 @@ 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->getOpcode() == Instruction::FDiv ||
+ I->getOpcode() == Instruction::FRem || isa<CallInst>(I)))
----------------
alexey-bataev wrote:
I'll try to add it
https://github.com/llvm/llvm-project/pull/115946
More information about the llvm-commits
mailing list