From c84e77aeaefccb8d0c4c508b8017dcad80607f53 Mon Sep 17 00:00:00 2001 From: Shiva Chen Date: Mon, 16 Apr 2018 01:58:39 +0000 Subject: [BasicAA] Return MayAlias for the pointer plus variable offset to structure object member Differential Revision: https://reviews.llvm.org/D45510 llvm-svn: 330106 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/lib') 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); } -- cgit v1.2.3