[PATCH] D24938: [x86] Rewrite getAddressFromInstr helper function

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 12:23:30 PST 2016


sunfish accepted this revision.
sunfish added a comment.
This revision is now accepted and ready to land.

Looks good to me. It's surprising that a function called getAddressFromInstr would mutate a MachineOperand for the input.



================
Comment at: lib/Target/X86/X86InstrBuilder.h:107
+  assert(Op1.isImm() && "Second address operand must be an immediate value");
+  AM.Scale = Op1.getImm();
+
----------------
MachineOperand::getImm() asserts isImm(), so it's redundant to assert isImm() before calling it. Same for getReg below.


https://reviews.llvm.org/D24938





More information about the llvm-commits mailing list