[PATCH] IR: Make the X / undef -> undef fold match the comment

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 17:07:12 PST 2016


Sanjoy Das <sanjoy at playingwithpointers.com> writes:
> lgtm
>
> Looks like the original code just had a typo; and after your change
> both the control flow and comments sync up to what I'd have expected.

Thanks. r261813.

> -- Sanjoy
>
> On Wed, Feb 24, 2016 at 4:46 PM, Justin Bogner <mail at justinbogner.com> wrote:
>> The constant folding for sdiv and udiv has a big discrepancy between the
>> comments and the code, which looks like a typo. Currently, we're folding
>> X / undef pretty inconsistently:
>>
>>   0 / undef -> undef
>>   C / undef -> 0
>>   undef / undef -> 0
>>
>> Whereas the comments state we do X / undef -> undef. The logic that
>> returns zero is actually commented as doing undef / X -> 0, despite that
>> the LHS isn't undef in many of the cases that hit it.
>>
>> Is this okay to commit, or is it the comments that should be updated to
>> match the code instead?
>>


More information about the llvm-commits mailing list