[LAA] Hide NeedRTCheck logic completely inside canCheckPtrAtRT, NFC
authorAdam Nemet <anemet@apple.com>
Thu, 9 Jul 2015 22:17:38 +0000 (22:17 +0000)
committerAdam Nemet <anemet@apple.com>
Thu, 9 Jul 2015 22:17:38 +0000 (22:17 +0000)
commit1c25d370c1092bdad7bd5d1c715af59e2b630940
tree7b2ad7d062c3f4b9b3bd6616d6baf7e9dde91be6
parent5cf6c0b07047c59732589082ccfe0abac96a271a
[LAA] Hide NeedRTCheck logic completely inside canCheckPtrAtRT, NFC

Currently canCheckPtrAtRT returns two flags NeedRTCheck and CanDoRT.
NeedRTCheck says whether we need checks and CanDoRT whether we can
generate the checks.  The idea is to encode three states with these:

     Need/Can:
(1) false/dont-care: no checks are needed
(2) true/false: we need checks but can't generate them
(3) true/true: we need checks and we can generate them

This is pretty unnecessary since the caller (analyzeLoop) is only
interested in whether we can generate the checks if we actually need
them (i.e. 1 or 3).

So this change cleans up to return just that (CanDoRTIfNeeded) and pulls
all the underlying logic into canCheckPtrAtRT.

By doing all this, we simplify analyzeLoop which is the complex function
in LAA.

There is further room for improvement here by using RtCheck.Need
directly rather than a new local variable NeedRTCheck but that's for a
later patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241866 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/LoopAccessAnalysis.cpp