[PATCH] D27803: [ARM] GlobalISel: Load i1, i8 and i16 args from stack

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 11:55:01 PST 2016

t.p.northover added inline comments.

Comment at: lib/Target/ARM/ARMCallLowering.cpp:134-142
+    if (VA.getLocInfo() == CCValAssign::SExt ||
+        VA.getLocInfo() == CCValAssign::ZExt)
+      // If the argument is zero- or sign-extended by the caller, its size
+      // becomes 4 bytes, so that's what we should load.
+      AddDefaultPred(MIRBuilder.buildInstr(ARM::LDRi12)
+                         .addDef(ValVReg)
+                         .addUse(Addr)
Is this necessary? Just because the caller stored  4 bytes doesn't mean we have to load 4. You might make some kind of efficiency argument if you expect most arithmetic to be done on i32 (as in C code), but I don't think this really helps there anyway because the G_SEXT/G_ZEXT will still exist in the MIR.

Also, if this really is necessary the `MMO` is misrecording the size of the memory operation.


More information about the llvm-commits mailing list