diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2015-05-05 18:10:49 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@dberlin.org> | 2015-05-05 18:10:49 +0000 |
commit | 3459d6ead59a2dd04a2f45cb356c867960748fa1 (patch) | |
tree | 134f85423c41881e7dda19ede15d6d79859c074b /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
parent | 73cf872adb7983c464ad24dc28827defdf6b11d4 (diff) | |
download | bcm5719-llvm-3459d6ead59a2dd04a2f45cb356c867960748fa1.tar.gz bcm5719-llvm-3459d6ead59a2dd04a2f45cb356c867960748fa1.zip |
Update BasicAliasAnalysis to understand that nothing aliases with undef values.
It got this in some cases (if one of them was an identified object), but not in all cases.
This caused stores to undef to block load-forwarding in some cases, etc.
Added test to Transforms/GVN to verify optimization occurs as expected.
llvm-svn: 236511
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 2767e41bee0..9fe744604b1 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -1389,6 +1389,11 @@ BasicAliasAnalysis::aliasCheck(const Value *V1, uint64_t V1Size, V1 = V1->stripPointerCasts(); V2 = V2->stripPointerCasts(); + // If V1 or V2 is undef, the result is NoAlias because we can always pick a + // value for undef that aliases nothing in the program. + if (isa<UndefValue>(V1) || isa<UndefValue>(V2)) + return NoAlias; + // Are we checking for alias of the same value? // Because we look 'through' phi nodes we could look at "Value" pointers from // different iterations. We must therefore make sure that this is not the |