[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 15:29:58 PST 2011


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<>.

-Chris




More information about the llvm-commits mailing list