OSDN Git Service

Fix a miscompile introduced in r220178.
authorChandler Carruth <chandlerc@gmail.com>
Mon, 20 Oct 2014 10:03:01 +0000 (10:03 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 20 Oct 2014 10:03:01 +0000 (10:03 +0000)
commit3ac929c473dbee6028111ecd032b3c97b40bd827
tree49bd469de659517caff3d8dd60719c14ab774053
parent7798534e7728a196390c6e9b48f33ebe11269c9e
Fix a miscompile introduced in r220178.

The original code had an implicit assumption that if the test for
allocas or globals was reached, the two pointers were not equal. With my
changes to make the pointer analysis more powerful here, I also had to
guard against circumstances where the results weren't useful. That in
turn violated the assumption and gave rise to a circumstance in which we
could have a store with both the queried pointer and stored pointer
rooted at *the same* alloca. Clearly, we cannot ignore such a store.
There are other things we might do in this code to better handle the
case of both pointers ending up at the same alloca or global, but it
seems best to at least make the test explicit in what it intends to
check.

I've added tests for both the alloca and global case here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220190 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/Loads.cpp
test/Transforms/InstCombine/load.ll