Skip to content

Commit c871f7a

Browse files
aparshin-inteligcbot
authored andcommitted
always try to widen byte moves
1 parent 38cd64d commit c871f7a

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXLegalization.cpp

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ class GenXLegalization : public FunctionPass {
223223
GenXBaling *Baling = nullptr;
224224
const GenXSubtarget *ST = nullptr;
225225
ScalarEvolution *SE = nullptr;
226-
bool EnableTransformByteMove = true;
227226
// Work variables when in the process of splitting a bale.
228227
// The Bale being split. (Also info on whether it has FIXED4 and TWICEWIDTH
229228
// operands.)
@@ -443,16 +442,6 @@ bool GenXLegalization::runOnFunction(Function &F) {
443442
"function arg not allowed to be illegally sized predicate");
444443
}
445444

446-
// TODO. remove this restriction.
447-
for (auto &GV : F.getParent()->getGlobalList()) {
448-
if (std::any_of(GV.user_begin(), GV.user_end(), [](Value *U) {
449-
return isa<LoadInst>(U) || isa<StoreInst>(U);
450-
})) {
451-
EnableTransformByteMove = false;
452-
break;
453-
}
454-
}
455-
456445
// Legalize instructions. This does a postordered depth first traversal of the
457446
// CFG, and scans backwards in each basic block, to ensure that, if we unbale
458447
// anything, it then gets processed subsequently.
@@ -718,19 +707,18 @@ bool GenXLegalization::processInst(Instruction *Inst) {
718707
}
719708
// Any other instruction: split.
720709
}
710+
721711
// Check if it is a byte move that we want to transform into a short/int move.
722-
if (EnableTransformByteMove) {
723-
auto *I8Ty = Type::getInt8Ty(Inst->getContext());
724-
auto *I16Ty = Type::getInt16Ty(Inst->getContext());
725-
auto *I32Ty = Type::getInt32Ty(Inst->getContext());
726-
if (transformMoveType(&B, I8Ty, I32Ty) ||
727-
transformMoveType(&B, I8Ty, I16Ty)) {
728-
// Successfully transformed. Run legalization on the new instruction
729-
// (which got inserted before the existing one, so will be processed
730-
// next).
731-
LLVM_DEBUG(dbgs() << "done transform of byte move\n");
732-
return false;
733-
}
712+
auto *I8Ty = Type::getInt8Ty(Inst->getContext());
713+
auto *I16Ty = Type::getInt16Ty(Inst->getContext());
714+
auto *I32Ty = Type::getInt32Ty(Inst->getContext());
715+
if (transformMoveType(&B, I8Ty, I32Ty) ||
716+
transformMoveType(&B, I8Ty, I16Ty)) {
717+
// Successfully transformed. Run legalization on the new instruction
718+
// (which got inserted before the existing one, so will be processed
719+
// next).
720+
LLVM_DEBUG(dbgs() << "done transform of byte move\n");
721+
return false;
734722
}
735723

736724
// Check if it is a 64-bit move that we want to transform into 32-bit move.

0 commit comments

Comments
 (0)