[llvm] 64af9f6 - [InstSimplify] add 'x + poison -> poison' (needed for NewGVN)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 2 09:28:58 PST 2022


Er, that really stinks that the public API of this utility is broken then.

Can you explain the context of why newgvn needs to "disable matching on 
undef" and instsimplify is fine to run without doing so?  If there's a 
clear comment in the code already, a pointer to that is fine.

Philip

On 1/2/22 9:26 AM, Nuno Lopes wrote:
> I don't think it can be reproduced with InstSimplify alone. 
> InstSimplify already simplified the test case I added. NewGVN disables 
> matching of undef, which InstSimplify does not.
>
> Nuno
>
>
> -----Original Message-----
> From: Philip Reames
> Sent: Sunday, January 2, 2022 5:10 PM
> Subject: Re: [llvm] 64af9f6 - [InstSimplify] add 'x + poison -> 
> poison' (needed for NewGVN)
>
> I agree, this really needs a test.  I see you later added a GVN test for
> the same, can you add an instsimplify one please?
>
> Philip
>
> On 12/30/21 4:02 AM, Roman Lebedev via llvm-commits wrote:
>> Test?
>>
>> On Thu, Dec 30, 2021 at 2:53 PM Nuno Lopes via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>>
>>> Author: Nuno Lopes
>>> Date: 2021-12-30T11:52:42Z
>>> New Revision: 64af9f61c30191482979c6883e4cc63703f12010
>>>
>>> URL: 
>>> https://github.com/llvm/llvm-project/commit/64af9f61c30191482979c6883e4cc63703f12010
>>> DIFF: 
>>> https://github.com/llvm/llvm-project/commit/64af9f61c30191482979c6883e4cc63703f12010.diff
>>>
>>> LOG: [InstSimplify] add 'x + poison -> poison' (needed for NewGVN)
>>>
>>> Added:
>>>
>>>
>>> Modified:
>>>      llvm/lib/Analysis/InstructionSimplify.cpp
>>>
>>> Removed:
>>>
>>>
>>>
>>> ################################################################################ 
>>>
>>> diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp 
>>> b/llvm/lib/Analysis/InstructionSimplify.cpp
>>> index 1c26ab3619089..4a8dc754349bd 100644
>>> --- a/llvm/lib/Analysis/InstructionSimplify.cpp
>>> +++ b/llvm/lib/Analysis/InstructionSimplify.cpp
>>> @@ -620,6 +620,10 @@ static Value *SimplifyAddInst(Value *Op0, Value 
>>> *Op1, bool IsNSW, bool IsNUW,
>>>     if (Constant *C = foldOrCommuteConstant(Instruction::Add, Op0, 
>>> Op1, Q))
>>>       return C;
>>>
>>> +  // X + poison -> poison
>>> +  if (isa<PoisonValue>(Op1))
>>> +    return Op1;
>>> +
>>>     // X + undef -> undef
>>>     if (Q.isUndefValue(Op1))
>>>       return Op1;
>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits 
>


More information about the llvm-commits mailing list