[PATCH] D26569: [InstCombine] Support load(gep(A, select(idx1, idx2)))) to select(load(gep(A, idx1)), load(gep(A, idx2))) transformation

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 19:27:16 PST 2016


wmi added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:886
+    Value *LastOp = GEPI->getOperand(LastIdx);
+    if (SelectInst *SI = dyn_cast<SelectInst>(LastOp)) {
+      GetElementPtrInst *NewGEP1 = cast<GetElementPtrInst>(GEPI->clone());
----------------
majnemer wrote:
> `auto *SI`
Ok, will fix it.


================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:907-908
+      } else {
+        delete NewGEP1;
+        delete NewGEP2;
+      }
----------------
majnemer wrote:
> Do not create IR if you don't think you will use it.
But I only need to insert the nodes into IR after isSafeToLoadUnconditionally return true for them.  Any suggestion for this case? 


Repository:
  rL LLVM

https://reviews.llvm.org/D26569





More information about the llvm-commits mailing list