This is an archive of the discontinued LLVM Phabricator instance.

[VPlan] Do not create VPWidenCall recipes for scalar vector factors.
ClosedPublic

Authored by fhahn on Apr 30 2022, 12:46 PM.

Details

Summary

'Widen' recipe are only used when actual vector values are generated.
Fix tryToWidenCall to do not create VPWidenCallRecipes for scalar vector
factors.

This was exposed by D123720, because the widened recipes are considered
vector users.

Diff Detail

Event Timeline

fhahn created this revision.Apr 30 2022, 12:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2022, 12:46 PM
fhahn requested review of this revision.Apr 30 2022, 12:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2022, 12:46 PM
Herald added a subscriber: vkmr. · View Herald Transcript
Ayal accepted this revision.May 2 2022, 4:50 AM

Looks good to me, adding a couple of nits.

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8331–8333

Early exit here as done in tryToWidenMemory's willWiden?

if (VF.isScalar())
  return false;

(Perhaps recipe creation for VF.isScalar() should be handled more systematically rather than individually by each try-to-widen/will-widen.)

llvm/test/Transforms/LoopVectorize/interleave-with-call.ll
15

nit: retain dumping of callee name as in call @llvm.smin.i32(...) rather than as an operand , ir<@llvm.smin.i32>?

This revision is now accepted and ready to land.May 2 2022, 4:50 AM
fhahn marked 2 inline comments as done.May 2 2022, 11:49 AM

Thanks Ayal!

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8331–8333

I added the early exit to willWiden to start with. We could add this as general check at the start of tryToWiden as follow up?

llvm/test/Transforms/LoopVectorize/interleave-with-call.ll
15

Thanks, I'll put up a separate patch for that!