[llvm-commits] [llvm] r145559 - in /llvm/trunk: include/llvm/Analysis/ lib/Analysis/ lib/Transforms/Scalar/ lib/Transforms/Utils/

Chris Lattner clattner at apple.com
Thu Dec 1 17:16:22 PST 2011

On Dec 1, 2011, at 3:53 PM, Chad Rosier wrote:

> On Dec 1, 2011, at 3:29 PM, Chris Lattner wrote:
>> On Dec 1, 2011, at 12:17 PM, Chad Rosier wrote:
>>> Hi Duncan,
>>> The issue I'm trying to resolve is in ConstantFoldCall.  Specifically, we shouldn't be folding library calls when -fno-builtin is specified; this requires TargetLibraryInfo.  Unfortunately, the folding routines are designed to be independent of a Pass, but getAnalysis and getAnalysisIfAvailable are not.  Therefore, I used the same convention as TargetData (i.e., pass it all over creation).  If I'm missing something here someone please chime in as I'm not particularly fond of the solution either.
>>> Also, please reply all in the future as I may miss something only addressed to the list. :)
>> An idiom that some code uses (e.g. SplitCriticalEdge) is to pass in a Pass* of the pass that is calling the helper.  The helper code can then use P->getAnalysisIfAvailable<>.
> Due to the recursive nature of the ConstantFold* routines I believe you'd just be trading TargetLibraryInfo* for Pass* except now you'd have to call P->getAnalysis<TargetLibraryInfo>(); then TLI->*, rather then TLI->* directly.  You could make the case that you could pass Pass* only rather then both TargetData* and TargetLibraryInfo*, but you still have the issue of making a call to getAnalysis* before you can actually use TD/TLI.

I agree that if we're just talking about TD and TLI, that it isn't worth it.  If we need some third parameter, it would be more clearly worthwhile.


More information about the llvm-commits mailing list