diff options
author | Chris Lattner <sabre@nondot.org> | 2011-04-26 01:21:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-04-26 01:21:15 +0000 |
commit | 1f821512fc1441480b3355305e0da5267073fe1c (patch) | |
tree | 6bba91bc3f9b51387c675e6663d88edee1ddbf48 /include/llvm/Analysis | |
parent | 0c99861836741911300587c579d4f9d3fe1d2a39 (diff) | |
download | external_llvm-1f821512fc1441480b3355305e0da5267073fe1c.zip external_llvm-1f821512fc1441480b3355305e0da5267073fe1c.tar.gz external_llvm-1f821512fc1441480b3355305e0da5267073fe1c.tar.bz2 |
Enhance MemDep: When alias analysis returns a partial alias result,
return it as a clobber. This allows GVN to do smart things.
Enhance GVN to be smart about the case when a small load is clobbered
by a larger overlapping load. In this case, forward the value. This
allows us to compile stuff like this:
int test(void *P) {
int tmp = *(unsigned int*)P;
return tmp+*((unsigned char*)P+1);
}
into:
_test: ## @test
movl (%rdi), %ecx
movzbl %ch, %eax
addl %ecx, %eax
ret
which has one load. We already handled the case where the smaller
load was from a must-aliased base pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r-- | include/llvm/Analysis/MemoryDependenceAnalysis.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h index 4d5dd19..f2e3353 100644 --- a/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h @@ -48,6 +48,11 @@ namespace llvm { /// this occurs when we see a may-aliased store to the memory location we /// care about. /// + /// There are several cases that may be interesting here: + /// 1. Loads are clobbered by may-alias stores. + /// 2. Loads are considered clobbered by partially-aliased loads. The + /// client may choose to analyze deeper into these cases. + /// /// A dependence query on the first instruction of the entry block will /// return a clobber(self) result. Clobber, |