[llvm-commits] [llvm] r170024 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
Michael Ilseman
milseman at apple.com
Thu Dec 13 14:03:54 PST 2012
Attached is a patch to correctly call the optimization. Included are a test case to help prevent this and a test case to test the optimization itself.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FoldPhi.patch
Type: application/octet-stream
Size: 1667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121213/45de3c08/attachment.obj>
-------------- next part --------------
On Dec 13, 2012, at 6:27 AM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> Thanks, Eric!
>
> Michael, I am sorry I mistook wording. :(
>
> ...Takumi
>
> 2012/12/13 Eric Christopher <echristo at gmail.com>:
>> I've gone ahead and reverted it here temporarily:
>>
>> M lib/Transforms/InstCombine/InstCombineAddSub.cpp
>> Committed r170106
>>
>> To get some of the bots back since it's been a while.
>>
>> Hopefully the PR will help Michael with a testcase.
>>
>> Thanks all.
>>
>> -eric
>>
>>
>> On Wed, Dec 12, 2012 at 8:51 PM, Will Dietz <w at wdtz.org> wrote:
>>>
>>> Ah, wish I saw this thread earlier today :).
>>>
>>> Please see: http://llvm.org/bugs/show_bug.cgi?id=14592 .
>>>
>>> Note that while it does break selfhosting for me, it also breaks
>>> llvm/clang when built with gcc (4.4.6).
>>>
>>> Reverting this commit locally un-breaks my build.
>>>
>>> ~Will
>>>
>>> On Wed, Dec 12, 2012 at 7:12 PM, Michael Ilseman <milseman at apple.com>
>>> wrote:
>>>>
>>>> On Dec 12, 2012, at 5:02 PM, NAKAMURA Takumi <geek4civic at gmail.com>
>>>> wrote:
>>>>
>>>>> Michael, it broke self hosting.
>>>>>
>>>>
>>>> Do you mean this commit broke it, or that my prior commit broke it and
>>>> this fixed it?
>>>>
>>>>> ...Takumi
>>>>>
>>>>> 2012/12/13 Michael Ilseman <milseman at apple.com>:
>>>>>> Author: milseman
>>>>>> Date: Wed Dec 12 14:59:36 2012
>>>>>> New Revision: 170024
>>>>>>
>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=170024&view=rev
>>>>>> Log:
>>>>>> Restore the PHI optimization I accidently removed
>>>>>>
>>>>>> Modified:
>>>>>> llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
>>>>>>
>>>>>> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
>>>>>> URL:
>>>>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=170024&r1=170023&r2=170024&view=diff
>>>>>>
>>>>>> ==============================================================================
>>>>>> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
>>>>>> (original)
>>>>>> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Wed
>>>>>> Dec 12 14:59:36 2012
>>>>>> @@ -354,6 +354,10 @@
>>>>>> if (Value *V = SimplifyFAddInst(LHS, RHS, I.getFastMathFlags(), TD))
>>>>>> return ReplaceInstUsesWith(I, V);
>>>>>>
>>>>>> + if (isa<PHINode>(LHS))
>>>>>> + if (Instruction *NV = FoldOpIntoPhi(I))
>>>>>> + return NV;
>>>>>> +
>>>>>> // -A + B --> B - A
>>>>>> // -A + -B --> -(A + B)
>>>>>> if (Value *LHSV = dyn_castFNegVal(LHS))
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> llvm-commits mailing list
>>>>>> llvm-commits at cs.uiuc.edu
>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
More information about the llvm-commits
mailing list