[RISCV] Fix operand number in debug message in RISCVMergeBaseOffset.
authorCraig Topper <craig.topper@sifive.com>
Tue, 2 Aug 2022 22:26:25 +0000 (15:26 -0700)
committerCraig Topper <craig.topper@sifive.com>
Tue, 2 Aug 2022 22:27:23 +0000 (15:27 -0700)
This used to print from the ADDI where the operand number was
correct. It recently changed to print from the LUI or AUIPC which
needs to use operand 1 instead of 2.

This shows up as a crash with -debug.

llvm/lib/Target/RISCV/RISCVMergeBaseOffset.cpp

index 7b2fb9f..d18e2ef 100644 (file)
@@ -426,7 +426,7 @@ bool RISCVMergeBaseOffsetOpt::runOnMachineFunction(MachineFunction &Fn) {
       if (!detectFoldable(Hi, Lo))
         continue;
       LLVM_DEBUG(dbgs() << "  Found lowered global address: "
-                        << *Hi.getOperand(2).getGlobal() << "\n");
+                        << *Hi.getOperand(1).getGlobal() << "\n");
       MadeChange |= detectAndFoldOffset(Hi, *Lo);
       MadeChange |= foldIntoMemoryOps(Hi, *Lo);
     }