]> granicus.if.org Git - llvm/commit
[ValueTracking] Avoid redundant known bits calculation in computeOverflowForSignedAdd()
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 22 Mar 2019 17:51:40 +0000 (17:51 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 22 Mar 2019 17:51:40 +0000 (17:51 +0000)
commitef29d0f46de231865fd2a927f2a0cee4cea7447c
treeae1f20c341f7637b52f696212df87e794d896d20
parenta8538579278c8368f83b0cca91a1d0e284b71bb5
[ValueTracking] Avoid redundant known bits calculation in computeOverflowForSignedAdd()

We're already computing the known bits of the operands here. If the
known bits of the operands can determine the sign bit of the result,
we'll already catch this in signedAddMayOverflow(). The only other
way (and as the comment already indicates) we'll get new information
from computing known bits on the whole add, is if there's an assumption
on it.

As such, we change the code to only compute known bits from assumptions,
instead of computing full known bits on the add (which would unnecessarily
recompute the known bits of the operands as well).

Differential Revision: https://reviews.llvm.org/D59473

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356785 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp