diff options
author | Nikita Popov <npopov@redhat.com> | 2023-12-07 14:09:05 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-12-07 14:10:59 +0100 |
commit | 6a1badfed2dcd438d94a35cc4ab3b38c7cc06208 (patch) | |
tree | eae2be091d3423fb1f4fa4eaf576bdbf28221122 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | f17e76697289e6a54e89298a49f12b6799dd3e1a (diff) | |
download | llvm-6a1badfed2dcd438d94a35cc4ab3b38c7cc06208.zip llvm-6a1badfed2dcd438d94a35cc4ab3b38c7cc06208.tar.gz llvm-6a1badfed2dcd438d94a35cc4ab3b38c7cc06208.tar.bz2 |
[ValueTracking] Add missing check when computing known bits from pointer icmp
I'm not sure whether it's possible to cause a miscompile due to
the missing check right now, as the affected values mechanism
effectively protects us against this. This becomes a problem for
an upcoming patch though.
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 ee4f97f..2c52107 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -620,7 +620,7 @@ static void computeKnownBitsFromCmp(const Value *V, CmpInst::Predicate Pred, if (RHS->getType()->isPointerTy()) { // Handle comparison of pointer to null explicitly, as it will not be // covered by the m_APInt() logic below. - if (match(RHS, m_Zero())) { + if (LHS == V && match(RHS, m_Zero())) { switch (Pred) { case ICmpInst::ICMP_EQ: Known.setAllZero(); |