Analyze recursive PHI nodes in BasicAA
authorTobias Edler von Koch <tobias@codeaurora.org>
Wed, 15 Jul 2015 19:32:22 +0000 (19:32 +0000)
committerTobias Edler von Koch <tobias@codeaurora.org>
Wed, 15 Jul 2015 19:32:22 +0000 (19:32 +0000)
commit3659b8adc91de08f83437b654df0ffd0c18769dc
tree56a3e9c59830504a761c64f7ce462a73b8ad6d13
parent162c547bf63dedbbeab2db055b1dee67645970c8
Analyze recursive PHI nodes in BasicAA

Summary:
This patch allows phi nodes like
  %x = phi [ %incptr, ... ] [ %var, ... ]
  %incptr = getelementptr %x, 1
to be analyzed by BasicAliasAnalysis.

In aliasPHI, we can detect incoming values that are recursive GEPs with a
constant offset. Instead of trying to analyze a recursive GEP (and failing),
we now ignore it and instead set the size of the memory referenced by
the PHINode to UnknownSize. This represents all the possible memory
locations the pointer represented by the PHINode could be advanced to
by the GEP.

For now, this new behavior is turned off by default to allow debugging of
performance degradations seen with SPEC/x86 and Hexagon benchmarks.
The flag -basicaa-recphi turns it on.

Reviewers: hfinkel, sanjoy

Subscribers: tobiasvk_caf, sanjoy, llvm-commits

Differential Revision: http://reviews.llvm.org/D10368

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242320 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/BasicAliasAnalysis.cpp
test/Analysis/BasicAA/phi-loop.ll [new file with mode: 0644]