[PATCH] Avoid nonsence dump string "0xXXXXXX: i1 = Constant<-1>" in output llc -debug

Andrey Kuharev an.kuharev at gmail.com
Mon May 26 06:36:13 PDT 2014


Modified test case

http://reviews.llvm.org/D3768

Files:
  lib/Support/APInt.cpp
  test/CodeGen/Generic/signed-one-bit-int.ll

Index: lib/Support/APInt.cpp
===================================================================
--- lib/Support/APInt.cpp
+++ lib/Support/APInt.cpp
@@ -2159,6 +2159,16 @@
     return;
   }
 
+  // Second, check for a one bit value and just short circuit the logic below.
+  if (*this == 1 && getBitWidth() == 1) {
+    while (*Prefix) {
+      Str.push_back(*Prefix);
+      ++Prefix;
+    };
+    Str.push_back('1');
+    return;
+  }
+
   static const char Digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
   if (isSingleWord()) {
Index: test/CodeGen/Generic/signed-one-bit-int.ll
===================================================================
--- test/CodeGen/Generic/signed-one-bit-int.ll
+++ test/CodeGen/Generic/signed-one-bit-int.ll
@@ -0,0 +1,16 @@
+; RUN: llc -debug %s -o /dev/null 2>&1 | FileCheck %s
+
+define i32 @main() #0 {
+entry:
+  %cmp = icmp eq i32 0, 1
+; CHECK: 0x{{[0-9a-f]+}}: ch = EntryToken
+; CHECK: 0x{{[0-9a-f]+}}: i1 = Constant<1>
+; CHECK: 0x{{[0-9a-f]+}}: ch = BasicBlock<if.end 0x{{[0-9a-f]+}}>
+  br i1 %cmp, label %if.then, label %if.end
+
+if.then: 
+  ret i32 1
+
+if.end:  
+  ret i32 0
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3768.9807.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140526/efe4b9fd/attachment.bin>


More information about the llvm-commits mailing list