Skip to content

Commit

Permalink
AArch64: Remove Bad optimization
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Keno authored and vchuravy committed Oct 1, 2021
1 parent 458b259 commit e4f1085
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions llvm/lib/Target/AArch64/AArch64FastISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4597,30 +4597,6 @@ bool AArch64FastISel::selectIntExt(const Instruction *I) {

// Try to optimize already sign-/zero-extended values from function arguments.
bool IsZExt = isa<ZExtInst>(I);
if (const auto *Arg = dyn_cast<Argument>(I->getOperand(0))) {
if ((IsZExt && Arg->hasZExtAttr()) || (!IsZExt && Arg->hasSExtAttr())) {
if (RetVT == MVT::i64 && SrcVT != MVT::i64) {
unsigned ResultReg = createResultReg(&AArch64::GPR64RegClass);
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
TII.get(AArch64::SUBREG_TO_REG), ResultReg)
.addImm(0)
.addReg(SrcReg, getKillRegState(SrcIsKill))
.addImm(AArch64::sub_32);
SrcReg = ResultReg;
}
// Conservatively clear all kill flags from all uses, because we are
// replacing a sign-/zero-extend instruction at IR level with a nop at MI
// level. The result of the instruction at IR level might have been
// trivially dead, which is now not longer true.
unsigned UseReg = lookUpRegForValue(I);
if (UseReg)
MRI.clearKillFlags(UseReg);

updateValueMap(I, SrcReg);
return true;
}
}

unsigned ResultReg = emitIntExt(SrcVT, SrcReg, RetVT, IsZExt);
if (!ResultReg)
return false;
Expand Down

0 comments on commit e4f1085

Please sign in to comment.