Skip to content

Commit f58bbe4

Browse files
committed
Use LLT instead of EVT in isZExtFree/isTruncateFree
1 parent 087160b commit f58bbe4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -3160,15 +3160,17 @@ bool CombinerHelper::matchHoistLogicOpWithSameOpcodeHands(
31603160
}
31613161
case TargetOpcode::G_TRUNC: {
31623162
// Match: logic (trunc X), (trunc Y) -> trunc (logic X, Y)
3163-
MachineFunction *MF = MI.getMF();
3164-
EVT DstEVT = getApproximateEVTForLLT(MRI.getType(Dst), MF->getDataLayout(),
3165-
MF->getFunction().getContext());
3166-
EVT XEVT = getApproximateEVTForLLT(XTy, MF->getDataLayout(),
3167-
MF->getFunction().getContext());
3163+
const MachineFunction *MF = MI.getMF();
3164+
const DataLayout &DL = MF->getDataLayout();
3165+
LLVMContext &Ctx = MF->getFunction().getContext();
3166+
3167+
LLT DstTy = MRI.getType(Dst);
31683168
const TargetLowering &TLI = getTargetLowering();
3169+
31693170
// Be extra careful sinking truncate. If it's free, there's no benefit in
31703171
// widening a binop.
3171-
if (TLI.isZExtFree(DstEVT, XEVT) && TLI.isTruncateFree(XEVT, DstEVT))
3172+
if (TLI.isZExtFree(DstTy, XTy, DL, Ctx) &&
3173+
TLI.isTruncateFree(XTy, DstTy, DL, Ctx))
31723174
return false;
31733175
break;
31743176
}

0 commit comments

Comments
 (0)