[PATCH] Update InstCombine to transform aggregate loads into scalar loads.

David Majnemer david.majnemer at gmail.com
Tue May 5 01:21:00 PDT 2015


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:318
@@ -318,1 +317,3 @@
+static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewTy,
+                                      const Twine& Suffix = "") {
   Value *Ptr = LI.getPointerOperand();
----------------
Ampersand goes on the right hand side.

================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:514-515
@@ +513,4 @@
+    if (ST->getNumElements() == 1) {
+      unsigned i = 0;
+      LoadInst *NewLoad = combineLoadToNewType(IC, LI, ST->getTypeAtIndex(i),
+                                               ".unpack");
----------------
Did you intend to use `i` for any particular purpose?  If not, please fold it into your call to `getTypeAtIndex`.

================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:517-521
@@ +516,7 @@
+                                               ".unpack");
+      Instruction *V = InsertValueInst::Create(
+        UndefValue::get(T), NewLoad, 0, LI.getName());
+
+      LI.replaceAllUsesWith(V);
+      return V;
+    }
----------------
Can this be:
  return ReplaceInstUsesWith(LI, Builder->CreateInsertValue(UndefValue::get(T), NewLoad, 0, LI.getName());

http://reviews.llvm.org/D8339

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list