[PATCH] D64888: Use the MachineBasicBlock symbol for a callbr target

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 15:20:54 PDT 2019


void added inline comments.


================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:435
+              const MachineFunction *MF = MI->getParent()->getParent();
+              for (auto I = MF->begin(), E = MF->end(); I != E; ++I)
+                if (BB == I->getBasicBlock()) {
----------------
nickdesaulniers wrote:
> range based for?
> ```
> for (const MachineBasicBlock& MBB : MF)
> ...
> ```
> 
> might even be able to replace `MF` with the expression above and still fit on 80 lines.
I tried that, but never was able to get the compiler to believe that MF had a "begin()" and "end()". Eventually just gave up... I'll try again though.


================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:433
               const BlockAddress *BA = MI->getOperand(OpNo).getBlockAddress();
-              MCSymbol *Sym = AP->GetBlockAddressSymbol(BA);
-              Sym->print(OS, AP->MAI);
+              const Value *BB = BA->getOperand(1);
+              const MachineFunction *MF = MI->getParent()->getParent();
----------------
nickdesaulniers wrote:
> `getBasicBlock()` would be a more explicit method to call, preferable to `getOperand(1)`.
Good call! :-)


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64888/new/

https://reviews.llvm.org/D64888





More information about the llvm-commits mailing list