[NewGVN] Use performSymbolicEvaluation instead of createExpression.
authorFlorian Hahn <flo@fhahn.com>
Sat, 24 Apr 2021 14:06:17 +0000 (15:06 +0100)
committerFlorian Hahn <flo@fhahn.com>
Sat, 24 Apr 2021 17:49:07 +0000 (18:49 +0100)
commit1cc5946cc80d75be76ac8a41e1a3697059273681
tree6a70ed29e63f0dbd300ad25b4db433196cce48d5
parent137568e5797c33c12d284cc325367ceaddf2441a
[NewGVN] Use performSymbolicEvaluation instead of createExpression.

performSymbolicEvaluation is used to obtain the symbolic expression when
visiting instructions and this is used to determine their congruence
class.

performSymbolicEvaluation only creates expressions for certain
instructions (via createExpression). For unsupported instructions,
'unknown' expression are created.

The use of createExpression in processOutgoingEdges means we may
simplify the condition in processOutgoingEdges to a constant in the
initial round of processing, but we use Unknown(I) for the congruence
class. If an operand of I changes the expression Unknown(I) stays the
same, so there is no update of the congruence class of I. Hence it
won't get re-visited. So if an operand of I changes in a way that causes
createExpression to return different result, this update is missed.

This patch updates the code to use performSymbolicEvaluation, to be
symmetric with the congruence class updating code.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D99990
llvm/lib/Transforms/Scalar/NewGVN.cpp
llvm/test/Transforms/NewGVN/compare-condition-changes.ll [new file with mode: 0644]