[llvm] 5e856a8 - [InstCombine] Use getFreedOperand() (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 05:35:37 PDT 2022


Author: Nikita Popov
Date: 2022-07-21T14:33:55+02:00
New Revision: 5e856a8578c139584d37986c6f72c591d4b2e31c

URL: https://github.com/llvm/llvm-project/commit/5e856a8578c139584d37986c6f72c591d4b2e31c
DIFF: https://github.com/llvm/llvm-project/commit/5e856a8578c139584d37986c6f72c591d4b2e31c.diff

LOG: [InstCombine] Use getFreedOperand() (NFC)

Use getFreedOperand() instead of isFreeCall() to remove the
implicit assumption that any pointer operand to a free function
is the operand being freed. This won't actually matter until we
handle allockind(free).

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index cae73589b59a..f401a1e1a6b1 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2801,7 +2801,8 @@ static bool isAllocSiteRemovable(Instruction *AI,
           continue;
         }
 
-        if (isFreeCall(I, &TLI) && getAllocationFamily(I, &TLI) == Family) {
+        if (getFreedOperand(cast<CallBase>(I), &TLI) == PI &&
+            getAllocationFamily(I, &TLI) == Family) {
           assert(Family);
           Users.emplace_back(I);
           continue;


        


More information about the llvm-commits mailing list