Move previously dead code to handle computing the known bits of an alias
authorChandler Carruth <chandlerc@gmail.com>
Sun, 19 Oct 2014 09:06:56 +0000 (09:06 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 19 Oct 2014 09:06:56 +0000 (09:06 +0000)
commit4d2a706176b3308e3033f80808873e18761b0930
treeba7d449bb8d266f251a86c7e07706260636e1d65
parent0fd4e2e5a1836e52e0851e0ebb811e301dfd807e
Move previously dead code to handle computing the known bits of an alias
up to where it actually works as intended. The problem is that
a GlobalAlias isa GlobalValue and so the prior block handled all of the
cases.

This allows us to constant fold based on the actual constant expression
in the global alias. As an example, see the last function in the newly
added test case which explicitly aligns an unaligned pointer using
constant expression math. Without this change, we fail to see that and
fold an alignment test to zero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220164 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp
test/Transforms/InstCombine/constant-fold-alias.ll [new file with mode: 0644]