diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-27 12:11:25 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-27 12:26:22 +0100 |
commit | 5a5a8088cc8d3f9fdca8c959dd3e48da13324aab (patch) | |
tree | 9158814fde056dbd396b404413aefa1c818de227 /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
parent | 41146bfe82aecc79961c3de898cda02998172e4b (diff) | |
download | llvm-5a5a8088cc8d3f9fdca8c959dd3e48da13324aab.zip llvm-5a5a8088cc8d3f9fdca8c959dd3e48da13324aab.tar.gz llvm-5a5a8088cc8d3f9fdca8c959dd3e48da13324aab.tar.bz2 |
[BasicAA] Retain shl nowrap flags in GetLinearExpression()
Nowrap flags between mul and shl differ in that mul nsw allows
multiplication of 1 * INT_MIN, while shl nsw does not. This means
that it is always fine to transfer shl nowrap flags to muls, but
not necessarily the other way around. In this case the NUW/NSW
results refer to mul/add operations, so it's fine to retain the
flags from the shl.
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index acf7bef..6246cad 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -314,10 +314,7 @@ static bool isObjectSize(const Value *V, uint64_t Size, const DataLayout &DL, Offset <<= RHS.getLimitedValue(); Scale <<= RHS.getLimitedValue(); - // the semantics of nsw and nuw for left shifts don't match those of - // multiplications, so we won't propagate them. - NSW = NUW = false; - return V; + break; } if (isa<OverflowingBinaryOperator>(BOp)) { |