This patch changes the strategy for vectorizing freeze instrucion, from replicating multiple times to widening according to selected VF.
Fixes #54992
Differential D125016
[LV] Widen freeze instead of scalarizing it Authored by lizhijin on May 5 2022, 8:28 AM.
Details This patch changes the strategy for vectorizing freeze instrucion, from replicating multiple times to widening according to selected VF. Fixes #54992
Diff Detail
Event TimelineComment Actions Hi @lizhijin, thanks a lot for the fix. This looks a lot better than the previous one! I just had a few minor comments ...
Comment Actions Widening freeze looks good, Alive2 also agrees https://alive2.llvm.org/ce/z/P3vnNs
Comment Actions Also the fix is not AArch64/SVE specific, so the title/description of the patch should probably be updated to reflect this. It could say something like [LV] Widen freeze instead of scalarizing it.. It would probably also be good to have a target independent test.
Comment Actions IIUC this fixes https://github.com/llvm/llvm-project/issues/54992. Could you add Fixes #54992 to the commit message to auto-close the issue when the patch lands?
| |||||||||||||||||||||||||||||||||||||||||||||
Maybe the Freeze instruction is better in it's own case statement at the bottom? i.e. something like
case Freeze: { State.ILV->setDebugLocFromInst(CI); for (unsigned Part = 0; Part < State.UF; ++Part) { SmallVector<Value *, 2> Ops; for (VPValue *VPOp : operands()) Ops.push_back(State.get(VPOp, Part)); Value *Freeze = Builder.CreateFreeze(Ops[0]); State.set(this, Freeze, Part); State.ILV->addMetadata(Cast, &I); } } break; }This avoids you having to check for the Freeze opcode as a special case in the loop below.