Skip to content

Commit e4f1085

Browse files
Kenovchuravy
authored andcommitted
AArch64: Remove Bad optimization
Removes the code responsible for causing https://bugs.llvm.org/show_bug.cgi?id=49357. A fix is in progress upstream, but I don't think it's easy, so this fixes the bug in the meantime. The optimization it does is minor.
1 parent 458b259 commit e4f1085

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

llvm/lib/Target/AArch64/AArch64FastISel.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4597,30 +4597,6 @@ bool AArch64FastISel::selectIntExt(const Instruction *I) {
45974597

45984598
// Try to optimize already sign-/zero-extended values from function arguments.
45994599
bool IsZExt = isa<ZExtInst>(I);
4600-
if (const auto *Arg = dyn_cast<Argument>(I->getOperand(0))) {
4601-
if ((IsZExt && Arg->hasZExtAttr()) || (!IsZExt && Arg->hasSExtAttr())) {
4602-
if (RetVT == MVT::i64 && SrcVT != MVT::i64) {
4603-
unsigned ResultReg = createResultReg(&AArch64::GPR64RegClass);
4604-
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
4605-
TII.get(AArch64::SUBREG_TO_REG), ResultReg)
4606-
.addImm(0)
4607-
.addReg(SrcReg, getKillRegState(SrcIsKill))
4608-
.addImm(AArch64::sub_32);
4609-
SrcReg = ResultReg;
4610-
}
4611-
// Conservatively clear all kill flags from all uses, because we are
4612-
// replacing a sign-/zero-extend instruction at IR level with a nop at MI
4613-
// level. The result of the instruction at IR level might have been
4614-
// trivially dead, which is now not longer true.
4615-
unsigned UseReg = lookUpRegForValue(I);
4616-
if (UseReg)
4617-
MRI.clearKillFlags(UseReg);
4618-
4619-
updateValueMap(I, SrcReg);
4620-
return true;
4621-
}
4622-
}
4623-
46244600
unsigned ResultReg = emitIntExt(SrcVT, SrcReg, RetVT, IsZExt);
46254601
if (!ResultReg)
46264602
return false;

0 commit comments

Comments
 (0)