Skip to content

Commit ca1b92f

Browse files
committed
[WIP][MachineLICM] Do not rely on hasSideEffect when handling impdefs
When hasSideEffect was set to 0 in the definition of LOADgotAUTH, the MultiSource/Benchmarks/Ptrdist/ks/ks test from llvm-test-suite started to crash. The issue was traced down to the MachineLICM pass placing LOADgotAUTH right after an unrelated copy to x16 like this: renamable $x16 = COPY renamable $x12 renamable $x20 = LOADgotAUTH target-flags(aarch64-got) @cost, implicit-def dead $x16, implicit-def dead $x17, implicit-def dead $nzcv B %bb.4
1 parent 23a674d commit ca1b92f

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

llvm/lib/CodeGen/MachineLICM.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -560,18 +560,15 @@ void MachineLICMImpl::ProcessMI(MachineInstr *MI, BitVector &RUDefs,
560560
if (!MO.isDead())
561561
// Non-dead implicit def? This cannot be hoisted.
562562
RuledOut = true;
563-
// No need to check if a dead implicit def is also defined by
564-
// another instruction.
565-
continue;
563+
} else {
564+
// FIXME: For now, avoid instructions with multiple defs, unless
565+
// it's a dead implicit def.
566+
if (Def)
567+
RuledOut = true;
568+
else
569+
Def = Reg;
566570
}
567571

568-
// FIXME: For now, avoid instructions with multiple defs, unless
569-
// it's a dead implicit def.
570-
if (Def)
571-
RuledOut = true;
572-
else
573-
Def = Reg;
574-
575572
// If we have already seen another instruction that defines the same
576573
// register, then this is not safe. Two defs is indicated by setting a
577574
// PhysRegClobbers bit.

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,6 +1995,7 @@ let Predicates = [HasPAuth] in {
19951995
Sched<[WriteI, ReadI]> {
19961996
let Defs = [X16,X17,NZCV];
19971997
let Size = 44;
1998+
let hasSideEffects = 0;
19981999
}
19992000

20002001
// Load a signed global address from a special $auth_ptr$ stub slot.

0 commit comments

Comments
 (0)