[llvm] fe230dc - [ValueTracking] Slightly clean up programUndefinedIfUndefOrPoison() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 30 14:06:59 PDT 2021
Author: Nikita Popov
Date: 2021-04-30T23:05:41+02:00
New Revision: fe230dc197b1cc259e497b88a6bc9c717318eebb
URL: https://github.com/llvm/llvm-project/commit/fe230dc197b1cc259e497b88a6bc9c717318eebb
DIFF: https://github.com/llvm/llvm-project/commit/fe230dc197b1cc259e497b88a6bc9c717318eebb.diff
LOG: [ValueTracking] Slightly clean up programUndefinedIfUndefOrPoison() (NFC)
Use contains() to check set membership, and adjust an oddly
structured loop.
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index e2c7253b4ff1..369ac4220bea 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -5400,10 +5400,9 @@ static bool programUndefinedIfUndefOrPoison(const Value *V,
SmallPtrSet<const Value *, 4> WellDefinedOps;
getGuaranteedWellDefinedOps(&I, WellDefinedOps);
- for (auto *Op : WellDefinedOps) {
- if (Op == V)
- return true;
- }
+ if (WellDefinedOps.contains(V))
+ return true;
+
if (!isGuaranteedToTransferExecutionToSuccessor(&I))
break;
}
@@ -5439,16 +5438,12 @@ static bool programUndefinedIfUndefOrPoison(const Value *V,
for_each(I.users(), Propagate);
}
- if (auto *NextBB = BB->getSingleSuccessor()) {
- if (Visited.insert(NextBB).second) {
- BB = NextBB;
- Begin = BB->getFirstNonPHI()->getIterator();
- End = BB->end();
- continue;
- }
- }
+ BB = BB->getSingleSuccessor();
+ if (!BB || !Visited.insert(BB).second)
+ break;
- break;
+ Begin = BB->getFirstNonPHI()->getIterator();
+ End = BB->end();
}
return false;
}
More information about the llvm-commits
mailing list