diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-27 12:58:46 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-27 14:50:09 +0100 |
commit | 60f3e8fbe44f12ea28760c2771f8bf48dc08abe8 (patch) | |
tree | 858b5be1f2764c947e17a3f9be485581b19ceaf6 /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
parent | ad9dad93ff1237aed820bac8ec8e172e73af786d (diff) | |
download | llvm-60f3e8fbe44f12ea28760c2771f8bf48dc08abe8.zip llvm-60f3e8fbe44f12ea28760c2771f8bf48dc08abe8.tar.gz llvm-60f3e8fbe44f12ea28760c2771f8bf48dc08abe8.tar.bz2 |
[BasicAA] Clarify entry values of GetLinearExpression() (NFC)
A number of variables need to be correctly initialized on entry
to GetLinearExpression() for the implementation to behave reasonably.
The fact that SExtBits can currenlty be non-zero on entry is a bug,
as demonstrated by the added test: For implicit sexts by the GEP,
we do currently skip legality checks.
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index ab0d180..6a6ddd6 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -237,6 +237,9 @@ static bool isObjectSize(const Value *V, uint64_t Size, const DataLayout &DL, unsigned &SExtBits, const DataLayout &DL, unsigned Depth, AssumptionCache *AC, DominatorTree *DT, bool &NSW, bool &NUW) { assert(V->getType()->isIntegerTy() && "Not an integer value"); + // TODO: SExtBits can be non-zero on entry. + assert(Scale == 0 && Offset == 0 && ZExtBits == 0 && NSW == true && + NUW == true && "Incorrect default values"); // Limit our recursion depth. if (Depth == 6) { @@ -251,7 +254,7 @@ static bool isObjectSize(const Value *V, uint64_t Size, const DataLayout &DL, // than the constant's (the Offset's always as wide as the outermost call), // so we'll zext here and process any extension in the isa<SExtInst> & // isa<ZExtInst> cases below. - Offset += Const->getValue().zextOrSelf(Offset.getBitWidth()); + Offset = Const->getValue().zextOrSelf(Offset.getBitWidth()); assert(Scale == 0 && "Constant values don't have a scale"); return V; } |