Skip to content

Commit

Permalink
[InstCombine] Use getFreedOperand() (NFC)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
nikic committed Jul 21, 2022
1 parent 3ac8587 commit 5e856a8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 5e856a8

Please sign in to comment.