[PATCH] D15890: Unpack array of all sizes in InstCombine

Mandeep Singh Grang via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 15:48:44 PST 2016


mgrang added a subscriber: mgrang.

================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:526
@@ -525,2 +525,3 @@
 
+  auto Name = LI.getName();
   assert(LI.getAlignment() && "Alignment must be set at this point");
----------------
Why can't we simply call LI.getName() wherever it is required rather than maintaining the variable "Name"?

================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:531
@@ -529,3 +530,3 @@
     // If the struct only have one element, we unpack.
-    unsigned Count = ST->getNumElements();
-    if (Count == 1) {
+    auto NumElements = ST->getNumElements();
+    if (NumElements == 1) {
----------------
Same here. Do we really need to maintain NumElements? Can we simply call ST->getNumElements() instead?

================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:582
@@ +581,3 @@
+    SmallString<16> EltName = Name;
+    EltName += ".elt";
+
----------------
I think these could be written better as:

SmallString<16> LoadName = LI->getName() + ".unpack";
SmallString<16> EltName = LI->getName() + ".elt";


http://reviews.llvm.org/D15890





More information about the llvm-commits mailing list