From 3712372fa5a59c8eea26f62c6aab95c486714248 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 11 Jan 2022 08:37:41 -0800 Subject: [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. :) --- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index bb2092f82b9c..d128884422f3 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(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(V)) return true; auto I = InvisibleToCallerBeforeRet.insert({V, false}); - if (I.second) { - auto *Inst = dyn_cast(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; } -- cgit v1.2.1