[PATCH] D35182: [InstCombine] remove one-use restriction for not (cmp P, A, B) --> cmp P', A, B

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 16:19:52 PDT 2017


davide added a comment.

In https://reviews.llvm.org/D35182#828371, @spatel wrote:

> In https://reviews.llvm.org/D35182#828364, @craig.topper wrote:
>
> > That's not really the IR for that C code is it. The C code has two global variables and the IR has two arguments.
>
>
> Oops - that's correct. I simplified the example from PR27431 to:
>
>   int fn1(int a, char b) { return (a && b) || (a && b); }
>   
>
> It shows the same problem though AFAICT.


Unless I'm reading this example incorrectly, which may be possible, this is clearly an example of redundant expression.
FWIW, you should be able to prove that:
`a' OR a` can be simplified to a 
if a is structurally equivalent to a'

In this case the two things are trivially structurally equivalent.
Same opcode, same operands.

This, FWIW, it's the whole point of doing value numbering.


https://reviews.llvm.org/D35182





More information about the llvm-commits mailing list