Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions llvm/lib/Transforms/Vectorize/VPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -1688,13 +1688,18 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags {

VPWidenIntrinsicRecipe(Intrinsic::ID VectorIntrinsicID,
ArrayRef<VPValue *> CallArguments, Type *Ty,
bool MayReadFromMemory, bool MayWriteToMemory,
bool MayHaveSideEffects, DebugLoc DL = {})
DebugLoc DL = {})
: VPRecipeWithIRFlags(VPDef::VPWidenIntrinsicSC, CallArguments),
VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty),
MayReadFromMemory(MayReadFromMemory),
MayWriteToMemory(MayWriteToMemory),
MayHaveSideEffects(MayHaveSideEffects) {}
VectorIntrinsicID(VectorIntrinsicID), ResultTy(Ty) {
LLVMContext &Ctx = Ty->getContext();
AttributeList Attrs = Intrinsic::getAttributes(Ctx, VectorIntrinsicID);
MemoryEffects ME = Attrs.getMemoryEffects();
MayReadFromMemory = ME.onlyWritesMemory();
MayWriteToMemory = ME.onlyReadsMemory();
MayHaveSideEffects = MayWriteToMemory ||
!Attrs.hasFnAttr(Attribute::NoUnwind) ||
!Attrs.hasFnAttr(Attribute::WillReturn);
}

~VPWidenIntrinsicRecipe() override = default;

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
Ops.push_back(&EVL);
return new VPWidenIntrinsicRecipe(Intrinsic::vp_select, Ops,
TypeInfo.inferScalarType(Sel),
false, false, false);
Sel->getDebugLoc());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also sets the debug info where it didn't set it before which is good to fix as well, thanks.

I think we need at least some tests for EVL vectorization with debug locations, to make sure they are preserved properly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, maybe need to create new tests similar to llvm/test/Transforms/LoopVectorize/debugloc.ll later, I think.

})

.Default([&](VPRecipeBase *R) { return nullptr; });
Expand Down
Loading