diff options
author | Nikita Popov <npopov@redhat.com> | 2022-01-04 16:04:25 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-01-04 16:08:09 +0100 |
commit | 6c031780aa2c08996d1351de5e7541c75d6645c5 (patch) | |
tree | 57a0984598752431626a473b5870cc015c6f3e05 /llvm/lib/IR/ConstantFold.cpp | |
parent | 25448826dd4c1965be08fa38cc02de9551084262 (diff) | |
download | llvm-6c031780aa2c08996d1351de5e7541c75d6645c5.zip llvm-6c031780aa2c08996d1351de5e7541c75d6645c5.tar.gz llvm-6c031780aa2c08996d1351de5e7541c75d6645c5.tar.bz2 |
[ConstantFold] Remove another incorrect icmp of gep fold
This folded (null + X) == g to false, but of course this is
incorrect if X == g.
Possibly this got confused with the null == g case, which is
already handled elsewhere.
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r-- | llvm/lib/IR/ConstantFold.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index 66e3a75..0d76dd7 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -1541,12 +1541,7 @@ static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2, return ICmpInst::ICMP_UGT; } } else if (const GlobalValue *GV2 = dyn_cast<GlobalValue>(V2)) { - if (isa<ConstantPointerNull>(CE1Op0)) { - // If its not weak linkage, the GVal must have a non-zero address - // so the result is less-than - if (!GV2->hasExternalWeakLinkage()) - return ICmpInst::ICMP_ULT; - } else if (const GlobalValue *GV = dyn_cast<GlobalValue>(CE1Op0)) { + if (const GlobalValue *GV = dyn_cast<GlobalValue>(CE1Op0)) { if (GV != GV2) { if (CE1GEP->hasAllZeroIndices()) return areGlobalsPotentiallyEqual(GV, GV2); |