[PATCH] D49203: [PM] Use getAnalysisIfAvailable / addUsedIfAvailable with StackProtector

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 13:15:24 PDT 2018


thegameg created this revision.
thegameg added reviewers: MatzeB, mattd, chandlerc, thanm.

When trying to use `llc -run-pass stack-coloring` or any other pass that
requires the StackProtector pass, the PM will fail with:

  Unable to schedule 'Slot index numbering' required by 'Merge disjoint stack slots'
  Unable to schedule pass
  UNREACHABLE executed at ../lib/IR/LegacyPassManager.cpp:1314!

The problem with StackProtector is that it is an IR pass which is added
as a dependency to an MI pass.

This patch makes it so passes only use the StackProtector pass if it is
available. In general, the pass is added in TargetPassConfig::addISelPrepare.

This allows these passes to be used with -run-pass or
-start-after/before.

It also fixes one machine verifier issue by using -run-pass instead of
re-running ISel on the whole IR.


https://reviews.llvm.org/D49203

Files:
  lib/CodeGen/LocalStackSlotAllocation.cpp
  lib/CodeGen/PrologEpilogInserter.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  lib/CodeGen/StackColoring.cpp
  test/CodeGen/X86/PR37310.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49203.155050.patch
Type: text/x-patch
Size: 6516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180711/2d701b61/attachment.bin>


More information about the llvm-commits mailing list