<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [SystemZ] SystemZISelDAGToDAG pass not registered properly"
   href="https://bugs.llvm.org/show_bug.cgi?id=50100">50100</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SystemZ]  SystemZISelDAGToDAG pass not registered properly
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: SystemZ
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>paulsson@linux.vnet.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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..?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>