diff options
author | Philip Reames <listmail@philipreames.com> | 2022-01-11 08:37:41 -0800 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2022-01-11 08:39:18 -0800 |
commit | 3712372fa5a59c8eea26f62c6aab95c486714248 (patch) | |
tree | c276c14d6466456344d8cbd0cf489faf687c380c | |
parent | 593b4d7a1c26b09b38497cdd71b623a3e9378609 (diff) | |
download | llvm-3712372fa5a59c8eea26f62c6aab95c486714248.tar.gz |
[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. :)
-rw-r--r-- | llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 21 |
1 files 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<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; } |