[PATCH] D71217: Fix incorrect logic in maintaining the side-effect of compiler generated outliner functions

Jin Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 11:47:00 PST 2020


jinlin marked 11 inline comments as done.
jinlin added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineOutliner.cpp:1258
+        for (; Iter != Last; Iter++) {
+          MachineInstr *MI = &*Iter;
+          for (MachineOperand &MOP : MI->operands()) {
----------------
tellenbach wrote:
> Can't this just be `MachineInstr *MI = Iter;`? You could actually just use `Iter` directly and omit the new variable.
The iterators you’ll be working with in the LLVM framework are special: they will automatically convert to a ptr-to-instance type whenever they need to. Instead of dereferencing the iterator and then taking the address of the result, you can simply assign the iterator to the proper pointer type and you get the dereference and address-of operation as a result of the assignment. You can refer to the details in http://llvm.org/docs/ProgrammersManual.html.


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

https://reviews.llvm.org/D71217





More information about the llvm-commits mailing list