diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-01-17 20:03:22 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-01-17 20:06:17 +0100 |
commit | 4229b87ed36cf20b95b363393452aa4815e344e2 (patch) | |
tree | 70c2a0bced2f1e6972daab71f8ab1fe4f6fb2df5 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 1cc477f030bdeb6de98c6bde89fa7850630def24 (diff) | |
download | llvm-4229b87ed36cf20b95b363393452aa4815e344e2.zip llvm-4229b87ed36cf20b95b363393452aa4815e344e2.tar.gz llvm-4229b87ed36cf20b95b363393452aa4815e344e2.tar.bz2 |
[ValueTracking] Fix isSafeToSpeculativelyExecute for sdiv (PR48778)
The != -1 check does not work correctly for all bitwidths. Use
isAllOnesValue() instead.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 61c992d..a9cef91 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4391,7 +4391,7 @@ bool llvm::isSafeToSpeculativelyExecute(const Value *V, if (*Denominator == 0) return false; // It's safe to hoist if the denominator is not 0 or -1. - if (*Denominator != -1) + if (!Denominator->isAllOnesValue()) return true; // At this point we know that the denominator is -1. It is safe to hoist as // long we know that the numerator is not INT_MIN. |