[PATCH] D13606: [Introduction] Redundant load reduction with invariant intrinsics

Larisse Voufo via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 18:37:44 PDT 2015


lvoufo marked 5 inline comments as done.
lvoufo added a comment.

I think I've addressed all the comment by now. I'll be pushing in split-up patches (with corrections) next.


================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:499
@@ -495,3 +498,3 @@
       // others.  GV may even be a declaration, not a definition.
-      if (!GV->isConstant()) {
+      if (!GV->isConstant() && !GV->getInvariantStartInstruction()) {
         Visited.clear();
----------------
GVs, like AIs, are marked "writeonce written" (via 'setInvariantStartInstruction') immediately after initialization. 
This test parallels a similar test above on AIs. That is, it should only succeed for non-"writeonce written" and non-constants.
Skipping instructions in MemoryDependenceAnalysis does not quite work in more general cases, such as where either the instantiated object itself is not const, but has const fields.
IIRC, I also ran into situations where GEPs where not eliminated as they should with their subesequent eliminated loads...
For the cases where this does work, I would rather leave it in a separate "improvement" patch.



http://reviews.llvm.org/D13606





More information about the llvm-commits mailing list