[SCCP] Use SimplifyBinOp for non-integer constant/expressions & overdef.
authorFlorian Hahn <flo@fhahn.com>
Fri, 10 Apr 2020 09:57:43 +0000 (10:57 +0100)
committerFlorian Hahn <flo@fhahn.com>
Fri, 10 Apr 2020 10:02:57 +0000 (11:02 +0100)
commit1a02aaeaa4f8675490da38ee8cb0d4a6d39815dd
treef3074e501b8efd85e2b62fe0dd0ebc7ea7b2a76c
parent9107594f376e37e99c71881404c686b306f93ad2
[SCCP] Use SimplifyBinOp for non-integer constant/expressions & overdef.

For non-integer constants/expressions and overdefined, I think we can
just use SimplifyBinOp to do common folds. By just passing a context
with the DL, SimplifyBinOp should not try to get additional information
from looking at definitions.

For overdefined values, it should be enough to just pass the original
operand.

Note: The comment before the `if (isconstant(V1State)...` was wrong
originally: isConstant() also matches integer ranges with a single
element. It is correct now.

Reviewers: efriedma, davide, mssimpso, aartbik

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D76459
llvm/lib/Transforms/Scalar/SCCP.cpp
llvm/test/Transforms/SCCP/ub-shift.ll
llvm/test/Transforms/SCCP/vector-bitcast.ll