This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Make MI.isLabel() return true for LOCAL_ESCAPE.
Needs ReviewPublic

Authored by ab on Mar 19 2017, 9:27 AM.

Details

Reviewers
rnk
Summary

Found by manual inspection: LOCAL_ESCAPE seems to have the same
properties as EH/GC labels: we can't remove it, and moving it is
constrained. Make isLabel acknowledge that.

The only use of isLabel is isPosition.

isPosition causes isSafeToMove to return false, which IIUC is
conservative intra-block but seems correct across blocks.

That in turn prevents DeadMachineInstructionElim from removing the
instruction, without the need for a special case.

The other changed uses of isPosition all seem harmless at worst:

  • AsmPrinter.cpp: doesn't count the label
  • MachineBasicBlock.cpp: changes the PHI elimination insert pt
  • MachineCSE.cpp: skips the label
  • PeepholeOptimizer.cpp: skips the label
  • TargetInstrInfo.cpp: scheduling boundary
  • X86InstrInfo.cpp: blocks outlining

Diff Detail

Event Timeline

ab created this revision.Mar 19 2017, 9:27 AM