[PATCH] D62684: [X86] Fixup LEAs - Fix inconsistent codegen with/without debug info

Chris Dawson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 03:06:53 PDT 2019


cdawson marked an inline comment as done.
cdawson added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineBasicBlock.cpp:1462
+  if (I != begin() && std::prev(I)->isMetaInstruction()) 
+    I = skipMetaInstructionsBackward(std::prev(I), begin());
+
----------------
aprantl wrote:
> I'm still somewhat confused by this line. Why are you skipping over the instruction *before* `I` here, but then check `I` (and not `std::prev(I)`) in the next line?
This is due to the way `skipMetaInstructionsBackward()` is implemented, it performs a meta check on the provided instruction and decrements backwards if the check succeeds. After we exit the preceding while loop (if we took it) we are either at `begin()` or a non-meta instruction, so to attempt to skip any earlier potential meta instructions we must look one instr back (which should be alright since we've already checked that we aren't at `begin()` in the `if`). `skipMetaInstructionsBackward()` will either return the first non-meta instruction if finds or `begin()`, even if `begin()` is a meta. Since we assign it to `I` it should still be alright to check `I` in succeeding `if`.

Hope that's sufficient info! Let me know if there's anything I didn't explain clearly enough :)


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

https://reviews.llvm.org/D62684





More information about the llvm-commits mailing list