[X86] Use existing MachineInstrBuilder::addDisp to create offseted pointer. NFC.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 19 Nov 2015 21:50:57 +0000 (21:50 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 19 Nov 2015 21:50:57 +0000 (21:50 +0000)
Minor code duplication tidyup to D13988

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253606 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.cpp

index 9cd1cd9a0fbfbbc20ed4261404acab0e8b45f343..41675c235ff349c9b9a6668aa7ca14bda4b16706 100644 (file)
@@ -5315,14 +5315,7 @@ static void addOperands(MachineInstrBuilder &MIB, ArrayRef<MachineOperand> MOs,
     for (unsigned i = 0; i != NumAddrOps; ++i) {
       const MachineOperand &MO = MOs[i];
       if (i == 3 && PtrOffset != 0) {
-        assert((MO.isImm() || MO.isGlobal()) &&
-               "Unexpected memory operand type");
-        if (MO.isImm()) {
-          MIB.addImm(MO.getImm() + PtrOffset);
-        } else {
-          MIB.addGlobalAddress(MO.getGlobal(), MO.getOffset() + PtrOffset,
-                               MO.getTargetFlags());
-        }
+        MIB.addDisp(MO, PtrOffset);
       } else {
         MIB.addOperand(MO);
       }