[PATCH] D81632: Fix undefined behavior in PeepholeOptimizer.
Bill Wendling via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 16 12:39:54 PDT 2020
void added a comment.
In D81632#2094672 <https://reviews.llvm.org/D81632#2094672>, @linzj wrote:
> > Which platform did you run valgrind on? The x86 platform should set SubIdx on all paths through it...
>
> ARM. armv8-linux-android.
Strange. SubIdx is initialized on all paths that return `true` in that function. So I'm not sure why valgrind complained...
My one worry with the change in this patch is that `0` is ostensibly a valid index, right? So how do we distinguish it from an invalid one if `isCoalescableExtInstr` returns `true` without properly initializing SubIdx?
bool AArch64InstrInfo::isCoalescableExtInstr(const MachineInstr &MI,
Register &SrcReg, Register &DstReg,
unsigned &SubIdx) const {
switch (MI.getOpcode()) {
default:
return false;
case AArch64::SBFMXri: // aka sxtw
case AArch64::UBFMXri: // aka uxtw
// Check for the 32 -> 64 bit extension case, these instructions can do
// much more.
if (MI.getOperand(2).getImm() != 0 || MI.getOperand(3).getImm() != 31)
return false;
// This is a signed or unsigned 32 -> 64 bit extension.
SrcReg = MI.getOperand(1).getReg();
DstReg = MI.getOperand(0).getReg();
SubIdx = AArch64::sub_32;
return true;
}
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81632/new/
https://reviews.llvm.org/D81632
More information about the llvm-commits
mailing list