Fix PTXGenerator after raw_pwrite_stream has been introduced
authorTobias Grosser <tobias@grosser.es>
Mon, 27 Apr 2015 12:06:32 +0000 (12:06 +0000)
committerTobias Grosser <tobias@grosser.es>
Mon, 27 Apr 2015 12:06:32 +0000 (12:06 +0000)
Without this patch Polly with GPGPU support enabled did not compile any more.

llvm-svn: 235868

polly/lib/CodeGen/PTXGenerator.cpp

index e2432b5..dc1339a 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/Support/Debug.h"
@@ -566,19 +567,19 @@ static bool createASMAsString(Module *New, const StringRef &Triple,
   PM.add(createTargetTransformInfoWrapperPass(Target.getTargetIRAnalysis()));
 
   {
-    raw_string_ostream NameROS(ASM);
-    formatted_raw_ostream FOS(NameROS);
+    SmallString<100> ASMSmall;
+    raw_svector_ostream NameROSSmall(ASMSmall);
 
     // Ask the target to add backend passes as necessary.
     int UseVerifier = true;
-    if (Target.addPassesToEmitFile(PM, FOS, TargetMachine::CGFT_AssemblyFile,
-                                   UseVerifier)) {
+    if (Target.addPassesToEmitFile(
+            PM, NameROSSmall, TargetMachine::CGFT_AssemblyFile, UseVerifier)) {
       errs() << "The target does not support generation of this file type!\n";
       return false;
     }
 
+    ASM = ASMSmall.c_str();
     PM.run(*New);
-    FOS.flush();
   }
 
   return true;