[PATCH] Teach instcombine to canonicalize "element extraction" from a load of an integer and "element insertion" into a store of an integer into actual element extraction, element insertion, and vector loads and stores.

Chandler Carruth chandlerc at gmail.com
Mon Dec 8 05:23:22 PST 2014


Thanks for the review! I've cleaned up the test a touch, added the pointer vector test, fixed the things you commented on.

Planning to commit. While I agree there may need to be more work if we start getting vectors of pointers and stuff, what I've tested already lowers better than the old code with the inputs we have today (floating point, and the existing backends).

================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:390
@@ +389,3 @@
+
+    // Check that the element type matches.
+    if (!ElementTy) {
----------------
hfinkel wrote:
> You have a more-explanatory comment for the store version, perhaps you could copy that here, "All of the elements extracted need to be the same type...."
Done.

================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:395
@@ +394,3 @@
+      if (!ElementTy->isSingleValueType() || ElementTy->isIntegerTy() ||
+          ElementTy->isVectorTy())
+        return false;
----------------
hfinkel wrote:
> So you will catch pointer types here and form vectors of pointers; this is likely worth a comment somewhere.
Sure.

http://reviews.llvm.org/D6548






More information about the llvm-commits mailing list