[PATCH] D109978: [CaptureTracking] Allow passing LI to PointerMayBeCapturedBefore (NFC).
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 20 01:18:00 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7f6a4826ac49: [CaptureTracking] Allow passing LI to PointerMayBeCapturedBefore (NFC). (authored by fhahn).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109978/new/
https://reviews.llvm.org/D109978
Files:
llvm/include/llvm/Analysis/CaptureTracking.h
llvm/lib/Analysis/CaptureTracking.cpp
Index: llvm/lib/Analysis/CaptureTracking.cpp
===================================================================
--- llvm/lib/Analysis/CaptureTracking.cpp
+++ llvm/lib/Analysis/CaptureTracking.cpp
@@ -98,10 +98,10 @@
/// as the given instruction and the use.
struct CapturesBefore : public CaptureTracker {
- CapturesBefore(bool ReturnCaptures, const Instruction *I, const DominatorTree *DT,
- bool IncludeI)
- : BeforeHere(I), DT(DT),
- ReturnCaptures(ReturnCaptures), IncludeI(IncludeI), Captured(false) {}
+ CapturesBefore(bool ReturnCaptures, const Instruction *I,
+ const DominatorTree *DT, bool IncludeI, const LoopInfo *LI)
+ : BeforeHere(I), DT(DT), ReturnCaptures(ReturnCaptures),
+ IncludeI(IncludeI), Captured(false), LI(LI) {}
void tooManyUses() override { Captured = true; }
@@ -115,7 +115,7 @@
return true;
// Check whether there is a path from I to BeforeHere.
- return !isPotentiallyReachable(I, BeforeHere, nullptr, DT);
+ return !isPotentiallyReachable(I, BeforeHere, nullptr, DT, LI);
}
bool captured(const Use *U) override {
@@ -140,6 +140,8 @@
bool IncludeI;
bool Captured;
+
+ const LoopInfo *LI;
};
}
@@ -183,7 +185,8 @@
bool llvm::PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures,
bool StoreCaptures, const Instruction *I,
const DominatorTree *DT, bool IncludeI,
- unsigned MaxUsesToExplore) {
+ unsigned MaxUsesToExplore,
+ const LoopInfo *LI) {
assert(!isa<GlobalValue>(V) &&
"It doesn't make sense to ask whether a global is captured.");
@@ -194,7 +197,7 @@
// TODO: See comment in PointerMayBeCaptured regarding what could be done
// with StoreCaptures.
- CapturesBefore CB(ReturnCaptures, I, DT, IncludeI);
+ CapturesBefore CB(ReturnCaptures, I, DT, IncludeI, LI);
PointerMayBeCaptured(V, &CB, MaxUsesToExplore);
if (CB.Captured)
++NumCapturedBefore;
Index: llvm/include/llvm/Analysis/CaptureTracking.h
===================================================================
--- llvm/include/llvm/Analysis/CaptureTracking.h
+++ llvm/include/llvm/Analysis/CaptureTracking.h
@@ -22,6 +22,7 @@
class DataLayout;
class Instruction;
class DominatorTree;
+ class LoopInfo;
/// getDefaultMaxUsesToExploreForCaptureTracking - Return default value of
/// the maximal number of uses to explore before giving up. It is used by
@@ -55,10 +56,12 @@
/// MaxUsesToExplore specifies how many uses the analysis should explore for
/// one value before giving up due too "too many uses". If MaxUsesToExplore
/// is zero, a default value is assumed.
- bool PointerMayBeCapturedBefore(
- const Value *V, bool ReturnCaptures, bool StoreCaptures,
- const Instruction *I, const DominatorTree *DT, bool IncludeI = false,
- unsigned MaxUsesToExplore = 0);
+ bool PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures,
+ bool StoreCaptures, const Instruction *I,
+ const DominatorTree *DT,
+ bool IncludeI = false,
+ unsigned MaxUsesToExplore = 0,
+ const LoopInfo *LI = nullptr);
/// This callback is used in conjunction with PointerMayBeCaptured. In
/// addition to the interface here, you'll need to provide your own getters
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109978.373502.patch
Type: text/x-patch
Size: 3640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210920/54ec0fca/attachment.bin>
More information about the llvm-commits
mailing list