[llvm-commits] [llvm] r78714 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/exact-sdiv.ll

Chris Lattner clattner at apple.com
Tue Aug 11 16:13:52 PDT 2009


On Aug 11, 2009, at 3:36 PM, Dan Gohman wrote:

>
> On Aug 11, 2009, at 3:16 PM, Eli Friedman wrote:
>
>
>> On Tue, Aug 11, 2009 at 1:47 PM, Dan Gohman<gohman at apple.com> wrote:
>>
>>> Author: djg
>>>
>>> Date: Tue Aug 11 15:47:47 2009
>>>
>>> New Revision: 78714
>>>
>>>
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=78714&view=rev
>>>
>>> Log:
>>>
>>> Optimize exact sdiv by a constant power of 2 to ashr.
>>>
>>
>> Do you think we want to optimize exact sdiv by any constant integer  
>> in
>> instcombine, or should we put that off to CodeGen?  For example,
>> should instcombine optimize "exact sdiv i32 %x, 3" to "mul i32 %x,
>> 2863311531"?
>
> Instcombine sounds reasonable for this kind of thing, provided that it
> happens after any other instcombine rules that know about exact sdiv.

I agree, instcombine should canonicalize a sdiv to a single mul if  
possible.

-Chris



More information about the llvm-commits mailing list