[llvm] [SandboxVec][DAG] Build actual dependencies (PR #111094)
Sriraman Tallam via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 14:37:43 PDT 2024
================
@@ -20,13 +26,35 @@ using namespace llvm;
struct DependencyGraphTest : public testing::Test {
LLVMContext C;
std::unique_ptr<Module> M;
+ std::unique_ptr<AssumptionCache> AC;
+ std::unique_ptr<DominatorTree> DT;
+ std::unique_ptr<BasicAAResult> BAA;
+ std::unique_ptr<AAResults> AA;
void parseIR(LLVMContext &C, const char *IR) {
SMDiagnostic Err;
M = parseAssemblyString(IR, Err, C);
if (!M)
Err.print("DependencyGraphTest", errs());
}
+
+ AAResults &getAA(llvm::Function &LLVMF) {
+ TargetLibraryInfoImpl TLII;
+ TargetLibraryInfo TLI(TLII);
+ AA = std::make_unique<AAResults>(TLI);
+ AC = std::make_unique<AssumptionCache>(LLVMF);
+ DT = std::make_unique<DominatorTree>(LLVMF);
+ BAA = std::make_unique<BasicAAResult>(M->getDataLayout(), LLVMF, TLI, *AC,
+ DT.get());
+ AA->addAAResult(*BAA);
+ return *AA;
+ }
+ /// \Returns true if there is a dependency: SrcN->DstN.
+ bool dependency(sandboxir::DGNode *SrcN, sandboxir::DGNode *DstN) {
+ const auto &Preds = DstN->memPreds();
+ auto It = find(Preds, SrcN);
+ return It != Preds.end();
+ }
----------------
tmsri wrote:
Why not add this as a member function to DGNode?
https://github.com/llvm/llvm-project/pull/111094
More information about the llvm-commits
mailing list