[PATCH] D111386: RFC: [Hexagon] Mark target as not "machine verifier clean"

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 7 22:17:02 PDT 2021


foad created this revision.
Herald added a subscriber: hiraditya.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Machine verification fails after the HexagonPacketizer pass with various
errors like:

- Bad machine code: Using an undefined physical register ***
- Bad machine code: Non-terminator instruction after the first terminator ***

This seems to be the only reason why TargetPassConfig disables machine
verification for the passes immediately following addPreEmitPass. If we
mark Hexagon as not machine verifier clean, then we can enable machine
verification in more places for all the other targets that are clean.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111386

Files:
  llvm/lib/CodeGen/TargetPassConfig.cpp
  llvm/lib/Target/Hexagon/HexagonTargetMachine.h


Index: llvm/lib/Target/Hexagon/HexagonTargetMachine.h
===================================================================
--- llvm/lib/Target/Hexagon/HexagonTargetMachine.h
+++ llvm/lib/Target/Hexagon/HexagonTargetMachine.h
@@ -44,6 +44,11 @@
   HexagonTargetObjectFile *getObjFileLowering() const override {
     return static_cast<HexagonTargetObjectFile*>(TLOF.get());
   }
+
+  bool isMachineVerifierClean() const override {
+    // Machine verification fails after HexagonPacketizer.
+    return false;
+  }
 };
 
 } // end namespace llvm
Index: llvm/lib/CodeGen/TargetPassConfig.cpp
===================================================================
--- llvm/lib/CodeGen/TargetPassConfig.cpp
+++ llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1245,11 +1245,9 @@
     // clobbered registers, to be used to optimize call sites.
     addPass(createRegUsageInfoCollector());
 
-  // FIXME: Some backends are incompatible with running the verifier after
-  // addPreEmitPass.  Maybe only pass "false" here for those targets?
-  addPass(&FuncletLayoutID, false);
+  addPass(&FuncletLayoutID);
 
-  addPass(&StackMapLivenessID, false);
+  addPass(&StackMapLivenessID);
   addPass(&LiveDebugValuesID, false);
 
   if (TM->Options.EnableMachineOutliner && getOptLevel() != CodeGenOpt::None &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111386.378091.patch
Type: text/x-patch
Size: 1286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211008/5e4bb9db/attachment.bin>


More information about the llvm-commits mailing list