[PATCH] D22305: [BasicAA] Strip phi nodes, when all incoming values are the same.

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 17:08:07 PDT 2016


hfinkel added inline comments.

================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:1427
@@ -1406,3 +1426,3 @@
   // Figure out what objects these things are pointing to if we can.
-  const Value *O1 = GetUnderlyingObject(V1, DL, MaxLookupSearchDepth);
-  const Value *O2 = GetUnderlyingObject(V2, DL, MaxLookupSearchDepth);
+  if (O1 == nullptr)
+    O1 = GetUnderlyingObject(V1, DL, MaxLookupSearchDepth);
----------------
Because GetUnderlyingObject is depth limited, as we walk up the use/def chain, we get closer to the real underlying object (in those somewhat-rare cases where we actually hit the depth cutoff). I'm quite happy to not do redundant work here, but we also don't want to regress on complex code either. I recommend trying something like this:

  O1 = GetUnderlyingObject(O1 ? O1 : V1, DL, O1 ? 1 : MaxLookupSearchDepth).



http://reviews.llvm.org/D22305





More information about the llvm-commits mailing list