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)
commit5b8cd2f73ce873c656e5cb4ebf3f6efececb780e
treee3d11f4b454a34a0a57a5dcfeb4b033defe5836b
parent312c3e5f39899e07c7f73e6687b8eeca1d6363cd
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.

llvm-svn: 220164
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstCombine/constant-fold-alias.ll [new file with mode: 0644]