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

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 08:57:58 PDT 2016


amehsan created this revision.
amehsan added reviewers: dberlin, hfinkel.
amehsan added a subscriber: llvm-commits.

This fixes the performance problem in PR27740. Also this patch includes code for a compile time opportunity in BasicAA.

Problem in 27740:

for the following pair :
%f35.pre-phi.i = phi float* [ %.pre6.i, %entry.if.else_crit_edge.i ], [ %.pre6.i, %land.lhs.true.if.else_crit_edge.i ]
%f11 = getelementptr inbounds %struct.s, %struct.s* %p1, i64 0, i32 1

where:
%.pre6.i = getelementptr inbounds %struct.s, %struct.s* %p1, i64 0, i32 3

We cannot prove that the pair is not aliased. This is because BasicAA first goes to aliasGEP, which recursively calls aliasCheck to look at aliasing for the base pointer of the GEP (with unknown size) and the phi node in the original pair. The result of that is a MayAlias.  A number of alternative solutions have been discussed in [[ https://llvm.org/bugs/show_bug.cgi?id=27740#c28 | this comment ]] and also discussed with Hal.

Also, some of the recursive calls to aliasCheck, from alias[GEP|Select|PHI] pass one of the values for which GetUnderlyingObject is already called, again. So if we keep the underlying object that is already calculated around, we won't need to recompute it, given this is an expensive call. 



http://reviews.llvm.org/D22305

Files:
  include/llvm/Analysis/BasicAliasAnalysis.h
  lib/Analysis/BasicAliasAnalysis.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22305.63809.patch
Type: text/x-patch
Size: 7449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160713/23e3d121/attachment.bin>


More information about the llvm-commits mailing list