[PATCH] D50893: [GVN] Assign new value number to calls reading memory, if there is no MemDep info.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 17 05:16:41 PDT 2018


fhahn created this revision.
fhahn added reviewers: efriedma, sebpop, john.brawn, wmi.

Currently we assign the same value number to two calls reading the same
memory location if we do not have MemoryDependence info. Without MemDep
Info we cannot guarantee that there is no store between the two calls, so we
have to assign a new number to the second call.

      

I am not sure how to best test this. The test/Analysis/BasicAA/pr18573.ll test
produces a wrong result without MemDepInfo.  createGVNPass takes a NoLoads
parameter, which selects whether MemoryDependenceAnalysis is run, but
I could not find an option to enable/disable in opt.


https://reviews.llvm.org/D50893

Files:
  lib/Transforms/Scalar/GVN.cpp


Index: lib/Transforms/Scalar/GVN.cpp
===================================================================
--- lib/Transforms/Scalar/GVN.cpp
+++ lib/Transforms/Scalar/GVN.cpp
@@ -401,9 +401,8 @@
       return ValNum.first;
     }
     if (!MD) {
-      uint32_t e = assignExpNewValueNum(exp).first;
-      valueNumbering[C] = e;
-      return e;
+      valueNumbering[C] = nextValueNumber;
+      return nextValueNumber++;
     }
 
     MemDepResult local_dep = MD->getDependency(C);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50893.161214.patch
Type: text/x-patch
Size: 482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180817/63b8e52a/attachment.bin>


More information about the llvm-commits mailing list