[llvm-bugs] [Bug 50100] New: [SystemZ] SystemZISelDAGToDAG pass not registered properly

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 23 07:09:32 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50100

            Bug ID: 50100
           Summary: [SystemZ]  SystemZISelDAGToDAG pass not registered
                    properly
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: SystemZ
          Assignee: unassignedbugs at nondot.org
          Reporter: paulsson at linux.vnet.ibm.com
                CC: llvm-bugs at lists.llvm.org

I noticed that when I do for example

llc -mtriple=s390x-linux-gnu -mcpu=z14 -O3 -print-after-all ...

I see:
# *** IR Dump After SystemZ DAG->DAG Pattern Instruction Selection
(amdgpu-isel) ***:

It's a little annoying (worrisome?) to see "amdgpu-isel" in parenthesis...

I am not sure how to properly initialize the pass... I tried several things but
didn't get it to work...:

With this:
diff --git a/llvm/lib/Target/SystemZ/SystemZ.h
b/llvm/lib/Target/SystemZ/SystemZ.h
index bedbd06..6df6545 100644
--- a/llvm/lib/Target/SystemZ/SystemZ.h
+++ b/llvm/lib/Target/SystemZ/SystemZ.h
@@ -187,6 +187,9 @@ static inline bool isImmHF(uint64_t Val) {
 }
 } // end namespace SystemZ

+class PassRegistry;
+void initializeSystemZDAGToDAGISelPass(PassRegistry&);
+
 FunctionPass *createSystemZISelDag(SystemZTargetMachine &TM,
                                    CodeGenOpt::Level OptLevel);
 FunctionPass *createSystemZElimComparePass(SystemZTargetMachine &TM);
diff --git a/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
b/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
index 39a82e2..796158c 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
@@ -346,8 +346,9 @@ class SystemZDAGToDAGISel : public SelectionDAGISel {
   SDValue expandSelectBoolean(SDNode *Node);

 public:
-  SystemZDAGToDAGISel(SystemZTargetMachine &TM, CodeGenOpt::Level OptLevel)
-      : SelectionDAGISel(TM, OptLevel) {}
+  SystemZDAGToDAGISel(SystemZTargetMachine *TM = nullptr,
+                      CodeGenOpt::Level OptLevel = CodeGenOpt::Default)
+      : SelectionDAGISel(*TM, OptLevel) {}

   bool runOnMachineFunction(MachineFunction &MF) override {
     const Function &F = MF.getFunction();
@@ -379,9 +380,12 @@ public:
 };
 } // end anonymous namespace

+INITIALIZE_PASS(SystemZDAGToDAGISel, "systemz-isel",
+                "SystemZ DAG->DAG Pattern Instruction Selection", false,
false)
+
 FunctionPass *llvm::createSystemZISelDag(SystemZTargetMachine &TM,
                                          CodeGenOpt::Level OptLevel) {
-  return new SystemZDAGToDAGISel(TM, OptLevel);
+  return new SystemZDAGToDAGISel(&TM, OptLevel);
 }

 // Return true if Val should be selected as a displacement for an address
diff --git a/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
b/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
index ebb8ed9..fa04766 100644
--- a/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp
@@ -32,6 +32,9 @@ using namespace llvm;
 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZTarget() {
   // Register the target.
   RegisterTargetMachine<SystemZTargetMachine> X(getTheSystemZTarget());
+
+  PassRegistry *PR = PassRegistry::getPassRegistry();
+  initializeSystemZDAGToDAGISelPass(*PR);
 }

 // Determine whether we use the vector ABI.

I get an error "Assertion `Inserted && "Pass registered multiple times!"'
failed.". 

I don't see any other targets than AMDGPU doing this initialization, which is a
bit strange - am I missing something here..?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210423/a4d0328c/attachment.html>


More information about the llvm-bugs mailing list