[llvm] [MemCpyOpt] Stop using callCapturesBefore() (PR #110484)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 03:30:22 PDT 2024
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/110484
After #110280 we use EarliestEscapeInfo, so callCapturesBefore() is mostly redundant. It can provide better results in some cases because EEI does an approximation across all captures. I hope that it's good enough in practice, as this is the last remaining user of callCapturesBefore(), so we'll be able to remove this API entirely.
>From 94e6ed66c60dff8403b862fe82e365f6357ddf78 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Mon, 30 Sep 2024 12:27:12 +0200
Subject: [PATCH] [MemCpyOpt] Stop using callCapturesBefore()
After #110280 we use EarliestEscapeInfo, so callCapturesBefore()
is mostly redundant. It can provide better results in some cases
because EEI does an approximation across all captures. I hope
that it's good enough in practice, as this is the last remaining
user of callCapturesBefore(), so we'll be able to remove this
API entirely.
---
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index b568811dcdbcac..cf6438b6a7b90c 100644
--- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -1054,11 +1054,7 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
// the use analysis, we also need to know that it does not sneakily
// access dest. We rely on AA to figure this out for us.
MemoryLocation DestWithSrcSize(cpyDest, LocationSize::precise(srcSize));
- ModRefInfo MR = BAA.getModRefInfo(C, DestWithSrcSize);
- // If necessary, perform additional analysis.
- if (isModOrRefSet(MR))
- MR = BAA.callCapturesBefore(C, DestWithSrcSize, DT);
- if (isModOrRefSet(MR))
+ if (isModOrRefSet(BAA.getModRefInfo(C, DestWithSrcSize)))
return false;
// We can't create address space casts here because we don't know if they're
More information about the llvm-commits
mailing list