[PATCH] [GVN] Perform Scalar PRE on gep indices that feed loads before doing Load PRE

Balaram Makam bmakam at codeaurora.org
Thu Nov 13 13:05:41 PST 2014


================
Comment at: lib/Transforms/Scalar/GVN.cpp:2447
@@ -2442,3 +2446,3 @@
 
-    // Don't perform PRE on a landing pad.
-    if (CurrentBlock->isLandingPad()) continue;
+  if (isa<AllocaInst>(CurInst) || isa<LoadInst>(CurInst) ||
+      isa<TerminatorInst>(CurInst) || isa<PHINode>(CurInst) ||
----------------
dberlin wrote:
> If you are going to add LoadInst, you might as well add all the memory ops (anything where getOpCode() > MemoryOpsBegin && getOpCode < MemoryOpsEnd. If you do this, i'd add isMemoryOp to instruction.h alongside isBinaryOp, etc) 
> 
Thanks for catching this Daniel. The LoadInst was unintentional, it is already covered by CurInst->mayReadFromMemory(). I will prepare a patch removing the LoadInst. If LGTM, please feel free to +2 it since I do not have commit rights.

http://reviews.llvm.org/D6103






More information about the llvm-commits mailing list