[llvm] 3712372 - [DSE] Style improvements after 3cef3cf - remove redundant dyn_casts [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 11 08:39:26 PST 2022
Author: Philip Reames
Date: 2022-01-11T08:39:18-08:00
New Revision: 3712372fa5a59c8eea26f62c6aab95c486714248
URL: https://github.com/llvm/llvm-project/commit/3712372fa5a59c8eea26f62c6aab95c486714248
DIFF: https://github.com/llvm/llvm-project/commit/3712372fa5a59c8eea26f62c6aab95c486714248.diff
LOG: [DSE] Style improvements after 3cef3cf - remove redundant dyn_casts [NFC]
I'd been working on exactly the same patch when Nikita landed his, so this patch is basically the style diff between the two. :)
Added:
Modified:
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index bb2092f82b9c0..d128884422f34 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -959,10 +959,8 @@ struct DSEState {
if (I.second) {
if (!isInvisibleToCallerBeforeRet(V)) {
I.first->second = false;
- } else {
- auto *Inst = dyn_cast<Instruction>(V);
- if (Inst && isNoAliasCall(Inst))
- I.first->second = !PointerMayBeCaptured(V, true, false);
+ } else if (isNoAliasCall(V)) {
+ I.first->second = !PointerMayBeCaptured(V, true, false);
}
}
return I.first->second;
@@ -972,15 +970,12 @@ struct DSEState {
if (isa<AllocaInst>(V))
return true;
auto I = InvisibleToCallerBeforeRet.insert({V, false});
- if (I.second) {
- auto *Inst = dyn_cast<Instruction>(V);
- if (Inst && isNoAliasCall(Inst))
- // NOTE: This could be made more precise by PointerMayBeCapturedBefore
- // with the killing MemoryDef. But we refrain from doing so for now to
- // limit compile-time and this does not cause any changes to the number
- // of stores removed on a large test set in practice.
- I.first->second = !PointerMayBeCaptured(V, false, true);
- }
+ if (I.second && isNoAliasCall(V))
+ // NOTE: This could be made more precise by PointerMayBeCapturedBefore
+ // with the killing MemoryDef. But we refrain from doing so for now to
+ // limit compile-time and this does not cause any changes to the number
+ // of stores removed on a large test set in practice.
+ I.first->second = !PointerMayBeCaptured(V, false, true);
return I.first->second;
}
More information about the llvm-commits
mailing list