[llvm] 7670938 - [Attributor] Don't print the call-graph in a hard-coded file.

Haojian Wu via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 18 00:38:23 PDT 2021


Author: Haojian Wu
Date: 2021-06-18T09:38:07+02:00
New Revision: 7670938bbad8755a34a282febc852651255c69b3

URL: https://github.com/llvm/llvm-project/commit/7670938bbad8755a34a282febc852651255c69b3
DIFF: https://github.com/llvm/llvm-project/commit/7670938bbad8755a34a282febc852651255c69b3.diff

LOG: [Attributor] Don't print the call-graph in a hard-coded file.

This looks like not a practical pattern in our codebase (it could fail
in some sandbox environement).

Instead we print it via standard output, and it is controled by the
-attributor-print-call-graph, this follows a similiar pattern of attributor-print-dep.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    llvm/test/Transforms/Attributor/callgraph.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 42f33a5c47bf..2855676a109e 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -8256,11 +8256,7 @@ AACallGraphNode *AACallEdgeIterator::operator*() const {
 }
 
 void AttributorCallGraph::print() {
-  std::string Filename = "AttributorCallGraph.dot";
-  std::error_code EC;
-
-  raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
-  llvm::WriteGraph(File, this);
+  llvm::WriteGraph(outs(), this);
 }
 
 const char AAReturnedValues::ID = 0;

diff  --git a/llvm/test/Transforms/Attributor/callgraph.ll b/llvm/test/Transforms/Attributor/callgraph.ll
index f3dfab2234de..d48c44c1aab4 100644
--- a/llvm/test/Transforms/Attributor/callgraph.ll
+++ b/llvm/test/Transforms/Attributor/callgraph.ll
@@ -1,7 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -passes=attributor -attributor-print-call-graph -S < %s | FileCheck %s --check-prefixes=CHECK
-; RUN: FileCheck %s -input-file=AttributorCallGraph.dot --check-prefix=DOT
-
+; RUN: opt -passes=attributor -S < %s | FileCheck %s --check-prefixes=CHECK
+; RUN: opt -passes=attributor -attributor-print-call-graph -S -disable-output < %s | FileCheck %s --check-prefixes=DOT
 
 define dso_local void @func1() {
 ; CHECK-LABEL: @func1(


        


More information about the llvm-commits mailing list