[InstCombine] Remove invariant group intrinsincs when comparing against null
authorArthur Eubanks <aeubanks@google.com>
Wed, 25 Aug 2021 18:31:22 +0000 (11:31 -0700)
committerArthur Eubanks <aeubanks@google.com>
Sun, 29 Aug 2021 22:45:25 +0000 (15:45 -0700)
commit099e4bcd5d069a744cf6df114f4e412755c4e59f
treef100fda9f2dd0ff36168d12b17d92d25929763a0
parent4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc
[InstCombine] Remove invariant group intrinsincs when comparing against null

We cannot leak any equivalency information by comparing against null
since null never has virtual metadata associated with it (when null is
not a valid dereferenceable pointer).

Instcombine seems to make sure that a null will be on the RHS, so we
don't have to check both operands.

This fixes a missed optimization in llvm-test-suite's MultiSource lambda
benchmark under -fstrict-vtable-pointers.

Reviewed By: Prazek

Differential Revision: https://reviews.llvm.org/D108734
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/invariant.group.ll