[llvm-commits] [llvm] r89659 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/constantfold-initializers.ll test/Transforms/InstCombine/cast.ll test/Transforms/InstCombine/shufflevec-constant.ll
Dan Gohman
gohman at apple.com
Mon Nov 30 14:26:52 PST 2009
On Nov 29, 2009, at 11:42 AM, Chris Lattner wrote:
>
> On Nov 23, 2009, at 8:22 AM, Dan Gohman wrote:
>
>> Author: djg
>> Date: Mon Nov 23 10:22:21 2009
>> New Revision: 89659
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=89659&view=rev
>> Log:
>> Make ConstantFoldConstantExpression recursively visit the entire
>> ConstantExpr, not just the top-level operator. This allows it to
>> fold many more constants.
>>
>> Also, make GlobalOpt call ConstantFoldConstantExpression on
>> GlobalVariable initializers.
>
> Hi Dan,
>
> My recollection is that instcombine uses this function, so making it more expensive is potentially bad. Have you looked for any compile time impact of this?
I don't expect to see a compile-time impact in normal cases, because
the new code is only significant when it encounters elaborate nested
unfoldable ConstantExprs, which don't happen very often, and because
instcombine uses a SmallPtrSet to avoid calling ConstantFoldConstantExpr
multiple times on the same constant within a run. It's probably possible
to construct a testcase which would see a difference, but compile time
still wouldn't be worse than proportional to the size of the program.
Dan
More information about the llvm-commits
mailing list