[polly] r336288 - [PPCGCodeGen] Change printf to outs() to prevent garbled output. [NFC]

Siddharth Bhat via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 4 09:51:27 PDT 2018


Author: bollu
Date: Wed Jul  4 09:51:27 2018
New Revision: 336288

URL: http://llvm.org/viewvc/llvm-project?rev=336288&view=rev
Log:
[PPCGCodeGen] Change printf to outs() to prevent garbled output. [NFC]

Summary:
It appears that llvm uses unbuffered C++ streams. So, we should not
mix C and C++ stream operations, because that will give us mixed
up output.

Reviewers: efriedma, jdoerfert, Meinersbur, gareevroman, sebpop, zinob, huihuiz, pollydev, grosser, singam-sanjay, philip.pfaffe

Reviewed By: philip.pfaffe

Subscribers: nemanjai, kbarton

Differential Revision: https://reviews.llvm.org/D40126

Modified:
    polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp

Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=336288&r1=336287&r2=336288&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Wed Jul  4 09:51:27 2018
@@ -3163,7 +3163,7 @@ public:
     auto *Options = isl_ast_print_options_alloc(S->getIslCtx().get());
     P = isl_ast_node_print(Kernel->tree, P, Options);
     char *String = isl_printer_get_str(P);
-    printf("%s\n", String);
+    outs() << String << "\n";
     free(String);
     isl_printer_free(P);
   }
@@ -3184,13 +3184,13 @@ public:
         isl_ast_print_options_set_print_user(Options, printHostUser, &Data);
     P = isl_ast_node_print(Tree, P, Options);
     char *String = isl_printer_get_str(P);
-    printf("# host\n");
-    printf("%s\n", String);
+    outs() << "# host\n";
+    outs() << String << "\n";
     free(String);
     isl_printer_free(P);
 
     for (auto Kernel : Data.Kernels) {
-      printf("# kernel%d\n", Kernel->id);
+      outs() << "# kernel" << Kernel->id << "\n";
       printKernel(Kernel);
     }
   }
@@ -3255,17 +3255,17 @@ public:
       else
         P = isl_printer_print_str(P, "No schedule found\n");
 
-      printf("%s\n", isl_printer_get_str(P));
+      outs() << isl_printer_get_str(P) << "\n";
       isl_printer_free(P);
     }
 
     if (DumpCode) {
-      printf("Code\n");
-      printf("====\n");
+      outs() << "Code\n";
+      outs() << "====\n";
       if (PPCGGen->tree)
         printGPUTree(PPCGGen->tree, PPCGProg);
       else
-        printf("No code generated\n");
+        outs() << "No code generated\n";
     }
 
     isl_schedule_free(Schedule);




More information about the llvm-commits mailing list