[SROA] Clean up some really weird code, no functionality changed.
authorChandler Carruth <chandlerc@gmail.com>
Thu, 10 Mar 2016 14:16:18 +0000 (14:16 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 10 Mar 2016 14:16:18 +0000 (14:16 +0000)
We already have the instruction extracted into 'I', just cast that to
a store the way we do for loads. Also, we don't enter the if unless SI
is non-null, so don't test it again for null.

I'm pretty sure the entire test there can be nuked, but this is just the
trivial cleanup.

llvm-svn: 263112

llvm/lib/Transforms/Scalar/SROA.cpp

index cee913d..a5c2f30 100644 (file)
@@ -3403,9 +3403,9 @@ bool SROA::presplitLoadsAndStores(AllocaInst &AI, AllocaSlices &AS) {
         }
 
         Loads.push_back(LI);
-      } else if (auto *SI = dyn_cast<StoreInst>(S.getUse()->getUser())) {
-        if (!SI ||
-            S.getUse() != &SI->getOperandUse(SI->getPointerOperandIndex()))
+      } else if (auto *SI = dyn_cast<StoreInst>(I)) {
+        if (S.getUse() != &SI->getOperandUse(SI->getPointerOperandIndex()))
+          // Skip stores *of* pointers. FIXME: This shouldn't even be possible!
           continue;
         auto *StoredLoad = dyn_cast<LoadInst>(SI->getValueOperand());
         if (!StoredLoad || !StoredLoad->isSimple())