diff options
author | Nikita Popov <npopov@redhat.com> | 2022-07-21 09:37:29 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-07-21 09:39:19 +0200 |
commit | f45ab433320fadf04aa90042337f1c2e509edb2c (patch) | |
tree | cc01901b49bd1009df031e845e5a8007cb79910f /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 3776db9a4fd2080d23d6a5f52e405eea44558761 (diff) | |
download | llvm-f45ab433320fadf04aa90042337f1c2e509edb2c.zip llvm-f45ab433320fadf04aa90042337f1c2e509edb2c.tar.gz llvm-f45ab433320fadf04aa90042337f1c2e509edb2c.tar.bz2 |
[MemoryBuiltins] Avoid isAllocationFn() call before checking removable alloc
Alloc directly checking whether a given call is a removable
allocation, instead of first checking whether it is an allocation
first.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 9b1bb93..83e67b1 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -439,8 +439,9 @@ bool llvm::wouldInstructionBeTriviallyDead(Instruction *I, return true; } - if (isAllocationFn(I, TLI) && isAllocRemovable(cast<CallBase>(I), TLI)) - return true; + if (auto *CB = dyn_cast<CallBase>(I)) + if (isRemovableAlloc(CB, TLI)) + return true; if (!I->willReturn()) return false; |