diff options
author | Shiva Chen <shiva0217@gmail.com> | 2018-04-16 01:58:39 +0000 |
---|---|---|
committer | Shiva Chen <shiva0217@gmail.com> | 2018-04-16 01:58:39 +0000 |
commit | c84e77aeaefccb8d0c4c508b8017dcad80607f53 (patch) | |
tree | aa2f96302bb01a915e8d12189626bbaa1be7d341 /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
parent | 4e644b38d715bb06c8a5cc193b793c0c5092b501 (diff) | |
download | bcm5719-llvm-c84e77aeaefccb8d0c4c508b8017dcad80607f53.tar.gz bcm5719-llvm-c84e77aeaefccb8d0c4c508b8017dcad80607f53.zip |
[BasicAA] Return MayAlias for the pointer plus variable offset to
structure object member
Differential Revision: https://reviews.llvm.org/D45510
llvm-svn: 330106
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 142589b68f8..0793d0189bc 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -1176,13 +1176,13 @@ bool BasicAAResult::isGEPBaseAtNegativeOffset(const GEPOperator *GEPOp, DecompObject.OtherOffset; // If the GEP has no variable indices, we know the precise offset - // from the base, then use it. If the GEP has variable indices, we're in - // a bit more trouble: we can't count on the constant offsets that come - // from non-struct sources, since these can be "rewound" by a negative - // variable offset. So use only offsets that came from structs. + // from the base, then use it. If the GEP has variable indices, + // we can't get exact GEP offset to identify pointer alias. So return + // false in that case. + if (!DecompGEP.VarIndices.empty()) + return false; int64_t GEPBaseOffset = DecompGEP.StructOffset; - if (DecompGEP.VarIndices.empty()) - GEPBaseOffset += DecompGEP.OtherOffset; + GEPBaseOffset += DecompGEP.OtherOffset; return (GEPBaseOffset >= ObjectBaseOffset + (int64_t)ObjectAccessSize); } |