[LV] Widen freeze instead of scalarizing it

This patch changes the strategy for vectorizing freeze instrucion, from
replicating multiple times to widening according to selected VF.

Fixes #54992

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D125016
This commit is contained in:
lizhijin
2022-05-19 12:20:33 +08:00
committed by zhongyunde
parent 861489af1b
commit 90ea81fcb2
2 changed files with 38 additions and 0 deletions

View File

@@ -8444,6 +8444,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I,
case Instruction::URem:
case Instruction::Xor:
case Instruction::ZExt:
case Instruction::Freeze:
return true;
}
return false;
@@ -9367,6 +9368,17 @@ void VPWidenRecipe::execute(VPTransformState &State) {
break;
}
case Instruction::Freeze: {
State.ILV->setDebugLocFromInst(&I);
for (unsigned Part = 0; Part < State.UF; ++Part) {
Value *Op = State.get(getOperand(0), Part);
Value *Freeze = Builder.CreateFreeze(Op);
State.set(this, Freeze, Part);
}
break;
}
case Instruction::ICmp:
case Instruction::FCmp: {
// Widen compares. Generate vector compares.