[GVN] Properly invalidate ICF cache when we simplify a value
authorArthur Eubanks <aeubanks@google.com>
Thu, 8 Apr 2021 18:44:23 +0000 (11:44 -0700)
committerArthur Eubanks <aeubanks@google.com>
Thu, 8 Apr 2021 21:01:57 +0000 (14:01 -0700)
commitc5d1ccbcdfb11c29c89a2789ac1e89cf4b270be7
tree427cba289bf0041c8427ec2bae2c772b479df604
parentf66e05a720f74409790bdede308380909f2ecd86
[GVN] Properly invalidate ICF cache when we simplify a value

This fixes a "Cached first special instruction is wrong!" assert.

The assert fires because replacing a value with another can cause an
instruction to no longer be "special" to ICF. In this case,
devirtualization happened, turning an indirect call to a
call to a willreturn function which is no longer special.

Reviewed By: nikic, rnk

Differential Revision: https://reviews.llvm.org/D99977
llvm/include/llvm/Analysis/InstructionPrecedenceTracking.h
llvm/lib/Analysis/InstructionPrecedenceTracking.cpp
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/simplify-icf-cache-invalidation.ll [new file with mode: 0644]