aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-29 07:56:39 +0000
committerChris Lattner <sabre@nondot.org>2004-07-29 07:56:39 +0000
commit730b1ad2c4e33dd8b0f22744ece4f884f44c816a (patch)
tree39d91f17ba20d4abf42e86ff094e09e1115bab65 /lib/Analysis
parent246b40ae7a4965dbc1b48ed112f47b62eb3f2fbf (diff)
downloadexternal_llvm-730b1ad2c4e33dd8b0f22744ece4f884f44c816a.zip
external_llvm-730b1ad2c4e33dd8b0f22744ece4f884f44c816a.tar.gz
external_llvm-730b1ad2c4e33dd8b0f22744ece4f884f44c816a.tar.bz2
Fix test/Regression/Analysis/BasicAA/2004-07-28-MustAliasbug.llx
This also fixes the miscompilation of MallocBench/gs with dead store elimination enabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 5c8dbe1..9145322 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -322,11 +322,15 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
BasePtr1 = GetGEPOperands(V1, GEP1Ops);
BasePtr2 = GetGEPOperands(V2, GEP2Ops);
- AliasResult GAlias =
- CheckGEPInstructions(BasePtr1->getType(), GEP1Ops, V1Size,
- BasePtr2->getType(), GEP2Ops, V2Size);
- if (GAlias != MayAlias)
- return GAlias;
+ // If GetGEPOperands were able to fold to the same must-aliased pointer,
+ // do the comparison.
+ if (BasePtr1 == BasePtr2) {
+ AliasResult GAlias =
+ CheckGEPInstructions(BasePtr1->getType(), GEP1Ops, V1Size,
+ BasePtr2->getType(), GEP2Ops, V2Size);
+ if (GAlias != MayAlias)
+ return GAlias;
+ }
}
}