]> granicus.if.org Git - llvm/commit
[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)
commit07bbe5e2922ece3928bbf9f093d8a7ffdb950ae3
tree049f6ad1479cd160c01b080b976ac42d70584109
parent92078fc49a70bf051b824bcf7fae18fabfd7e2b7
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356456 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/InstructionSimplify.cpp
test/Transforms/InstCombine/icmp.ll
test/Transforms/NewGVN/pr31613.ll