[PATCH] D38594: [InlineCost] Tracking Values through PHI Nodes

Easwaran Raman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 11 19:21:59 PST 2017


eraman added inline comments.


================
Comment at: lib/Analysis/InlineCost.cpp:495
+
+      continue;
+    }
----------------
eraman wrote:
> If you have a phi with null as one incoming value and a non-null pointer with a constant offset as the other incoming argument, this code would incorrectly treat the result of the phi as null. Inside the loop, both FirstC and FirstV will be non-null and after exiting the loop , SimplifiedValues[&I] will be set to FirstC. 
This version also suffers from the same issue if the order of the phi is reversed (you first see a non-null pointer with constant offset and then see the null).  I think it will be easier to first check if you have seen a reachable incoming value and then check if it is constant or constant offset and then make sure the phi you see now is the same.  Add a test case as well after fixing this. 


Repository:
  rL LLVM

https://reviews.llvm.org/D38594





More information about the llvm-commits mailing list