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

Pete Cooper peter_cooper at apple.com
Fri Apr 17 12:28:38 PDT 2015


You probably need to wait for some of the other commenters to give the final ok on this, but FWIW it LGTM with the changes I pointed out.

Cheers,
Pete


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:502
@@ +501,3 @@
+  // stores here but it isn't clear that this is important.
+  if (!LI.isSimple())
+    return nullptr;
----------------
I think this should now be an assert as you've moved the call to unpackLoadToAggregate below an identical check.

================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:506
@@ +505,3 @@
+  Value *Ptr = LI.getPointerOperand();
+  Type *T = cast<PointerType>(Ptr->getType())->getElementType();
+
----------------
This can just be LI.getType() instead of going through the pointer type.

================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:508
@@ +507,3 @@
+
+  if (!T->isAggregateType())
+    return nullptr;
----------------
If you're planning on handling arrays then please ignore me, but otherwise you don't need this check as you already explicitly check for struct types below.

http://reviews.llvm.org/D8339

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






More information about the llvm-commits mailing list