[InstSimplify] SimplifyICmpInst - icmp eq/ne %X, undef -> undef
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 19 Mar 2019 14:08:23 +0000 (14:08 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 19 Mar 2019 14:08:23 +0000 (14:08 +0000)
commit8ee477a2ab6a9dc184359e634c91925ea347888f
tree636cb2656653a1e5fa3aea4392b3441076d64304
parentdd59d27a1f8aa993187f8476cccf98bcc9f24ec2
[InstSimplify] SimplifyICmpInst - icmp eq/ne %X, undef -> undef

As discussed on PR41125 and D59363, we have a mismatch between icmp eq/ne cases with an undef operand:

When the other operand is constant we fold to undef (handled in ConstantFoldCompareInstruction)
When the other operand is non-constant we fold to a bool constant based on isTrueWhenEqual (handled in SimplifyICmpInst).

Neither is really wrong, but this patch changes the logic in SimplifyICmpInst to consistently fold to undef.

The NewGVN test change is annoying (as with most heavily reduced tests) but AFAICT I have kept the purpose of the test based on rL291968.

Differential Revision: https://reviews.llvm.org/D59541

llvm-svn: 356456
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstCombine/icmp.ll
llvm/test/Transforms/NewGVN/pr31613.ll