diff options
| author | Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> | 2007-12-13 16:22:58 +0000 | 
|---|---|---|
| committer | Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> | 2007-12-13 16:22:58 +0000 | 
| commit | 86d51b896ea8ff4fe3dc78a0b302286e80ead920 (patch) | |
| tree | 271b06d17c68f5bbfb4ab48652553636e0b9e253 /llvm/lib/Analysis | |
| parent | a5be19d3df1da35e1a091c1d063192e922c58ab0 (diff) | |
| download | bcm5719-llvm-86d51b896ea8ff4fe3dc78a0b302286e80ead920.tar.gz bcm5719-llvm-86d51b896ea8ff4fe3dc78a0b302286e80ead920.zip | |
Make these loops follow GetGEPOperands() behavior.
Let: %q = GEP %p, X, ...
If %p is a GEP, we can chase baseptr further, only if X==0.
llvm-svn: 44999
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 24 | 
1 files changed, 13 insertions, 11 deletions
| diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 557d521546c..7ce9d1651f7 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -391,17 +391,19 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,    if (isGEP(V1) && isGEP(V2)) {      // Drill down into the first non-gep value, to test for must-aliasing of      // the base pointers. -    const Value *BasePtr1 = V1, *BasePtr2 = V2; -    do { -      BasePtr1 = cast<User>(BasePtr1)->getOperand(0); -    } while (isGEP(BasePtr1) && -             cast<User>(BasePtr1)->getOperand(1) == -       Constant::getNullValue(cast<User>(BasePtr1)->getOperand(1)->getType())); -    do { -      BasePtr2 = cast<User>(BasePtr2)->getOperand(0); -    } while (isGEP(BasePtr2) && -             cast<User>(BasePtr2)->getOperand(1) == -       Constant::getNullValue(cast<User>(BasePtr2)->getOperand(1)->getType())); +    const User *G = cast<User>(V1); +    while (isGEP(G->getOperand(0)) && +           G->getOperand(1) == +           Constant::getNullValue(G->getOperand(1)->getType())) +      G = cast<User>(G->getOperand(0)); +    const Value *BasePtr1 = G->getOperand(0); + +    G = cast<User>(V2); +    while (isGEP(G->getOperand(0)) && +           G->getOperand(1) == +           Constant::getNullValue(G->getOperand(1)->getType())) +      G = cast<User>(G->getOperand(0)); +    const Value *BasePtr2 = G->getOperand(0);      // Do the base pointers alias?      AliasResult BaseAlias = alias(BasePtr1, ~0U, BasePtr2, ~0U); | 

