Skip to content

Commit aa2549e

Browse files
AZero13tstellar
authored andcommitted
Revert "[SLP]Fix a crash if the argument of call was affected by minbitwidth analysis."
After reconsidering the words of @nikic, I have decided to revisit the patches I suggested be backported. Upon further analysis, I think there is a high likelihood that this change added to release 18.x was referencing a crash that was caused by a PR that isn't added. I will, however, keep the test that was added just in case. This reverts commit 6e071cf.
1 parent c6d5546 commit aa2549e

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

+1-20
Original file line numberDiff line numberDiff line change
@@ -11653,12 +11653,12 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E, bool PostponedPHIs) {
1165311653
if (UseIntrinsic && isVectorIntrinsicWithOverloadTypeAtArg(ID, -1))
1165411654
TysForDecl.push_back(
1165511655
FixedVectorType::get(CI->getType(), E->Scalars.size()));
11656-
auto *CEI = cast<CallInst>(VL0);
1165711656
for (unsigned I : seq<unsigned>(0, CI->arg_size())) {
1165811657
ValueList OpVL;
1165911658
// Some intrinsics have scalar arguments. This argument should not be
1166011659
// vectorized.
1166111660
if (UseIntrinsic && isVectorIntrinsicWithScalarOpAtArg(ID, I)) {
11661+
CallInst *CEI = cast<CallInst>(VL0);
1166211662
ScalarArg = CEI->getArgOperand(I);
1166311663
OpVecs.push_back(CEI->getArgOperand(I));
1166411664
if (isVectorIntrinsicWithOverloadTypeAtArg(ID, I))
@@ -11671,25 +11671,6 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E, bool PostponedPHIs) {
1167111671
LLVM_DEBUG(dbgs() << "SLP: Diamond merged for " << *VL0 << ".\n");
1167211672
return E->VectorizedValue;
1167311673
}
11674-
auto GetOperandSignedness = [&](unsigned Idx) {
11675-
const TreeEntry *OpE = getOperandEntry(E, Idx);
11676-
bool IsSigned = false;
11677-
auto It = MinBWs.find(OpE);
11678-
if (It != MinBWs.end())
11679-
IsSigned = It->second.second;
11680-
else
11681-
IsSigned = any_of(OpE->Scalars, [&](Value *R) {
11682-
return !isKnownNonNegative(R, SimplifyQuery(*DL));
11683-
});
11684-
return IsSigned;
11685-
};
11686-
ScalarArg = CEI->getArgOperand(I);
11687-
if (cast<VectorType>(OpVec->getType())->getElementType() !=
11688-
ScalarArg->getType()) {
11689-
auto *CastTy = FixedVectorType::get(ScalarArg->getType(),
11690-
VecTy->getNumElements());
11691-
OpVec = Builder.CreateIntCast(OpVec, CastTy, GetOperandSignedness(I));
11692-
}
1169311674
LLVM_DEBUG(dbgs() << "SLP: OpVec[" << I << "]: " << *OpVec << "\n");
1169411675
OpVecs.push_back(OpVec);
1169511676
if (UseIntrinsic && isVectorIntrinsicWithOverloadTypeAtArg(ID, I))

0 commit comments

Comments
 (0)