[PATCH] D52933: Fix incorrect Twine usage in CFGPrinter

Kristina Brooks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 10:31:48 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL343984: Fix incorrect Twine usage in CFGPrinter (authored by kristina, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52933?vs=168630&id=168681#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52933

Files:
  llvm/trunk/include/llvm/Analysis/CFGPrinter.h
  llvm/trunk/test/Other/cfg-printer-branch-weights.ll


Index: llvm/trunk/test/Other/cfg-printer-branch-weights.ll
===================================================================
--- llvm/trunk/test/Other/cfg-printer-branch-weights.ll
+++ llvm/trunk/test/Other/cfg-printer-branch-weights.ll
@@ -0,0 +1,19 @@
+;RUN: opt < %s -analyze -dot-cfg 2>/dev/null
+;RUN: FileCheck %s -input-file=cfg.f.dot
+
+define void @f(i32) {
+entry:
+  %check = icmp sgt i32 %0, 0
+  br i1 %check, label %if, label %exit, !prof !0
+
+; CHECK: label="W:1"
+; CHECK-NOT: ["];
+if:                     ; preds = %entry
+  br label %exit
+; CHECK: label="W:200"
+; CHECK-NOT: ["];
+exit:                   ; preds = %entry, %if
+  ret void
+}
+
+!0 = !{!"branch_weights", i32 1, i32 200}
Index: llvm/trunk/include/llvm/Analysis/CFGPrinter.h
===================================================================
--- llvm/trunk/include/llvm/Analysis/CFGPrinter.h
+++ llvm/trunk/include/llvm/Analysis/CFGPrinter.h
@@ -172,8 +172,7 @@
 
     // Prepend a 'W' to indicate that this is a weight rather than the actual
     // profile count (due to scaling).
-    Twine Attrs = "label=\"W:" + Twine(Weight->getZExtValue()) + "\"";
-    return Attrs.str();
+    return ("label=\"W:" + Twine(Weight->getZExtValue()) + "\"").str();
   }
 };
 } // End llvm namespace


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52933.168681.patch
Type: text/x-patch
Size: 1277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181008/72fa2703/attachment.bin>


More information about the llvm-commits mailing list