[llvm-commits] [gcc-plugin] r81339 - /gcc-plugin/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Wed Sep 9 06:07:08 PDT 2009


Author: baldrick
Date: Wed Sep  9 08:07:07 2009
New Revision: 81339

URL: http://llvm.org/viewvc/llvm-project?rev=81339&view=rev
Log:
It seems that labels need not have names (llvm-gcc was right).

Modified:
    gcc-plugin/trunk/llvm-convert.cpp

Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81339&r1=81338&r2=81339&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Wed Sep  9 08:07:07 2009
@@ -767,19 +767,20 @@
     return I->second;
 
   // Otherwise, create a new LLVM basic block.
-  BasicBlock *BB = BasicBlock::Create(Context);
+  BasicBlock *BB = BasicBlocks[bb] = BasicBlock::Create(Context);
 
   // If BB contains labels, name the LLVM basic block after the first one.
   gimple stmt = first_stmt (bb);
-  if (stmt && gimple_code (stmt) == GIMPLE_LABEL) {
-    BB->setName(IDENTIFIER_POINTER(DECL_NAME(gimple_label_label(stmt))));
-  } else {
-    // Use the same basic block naming scheme as the GCC tree dumps.
-    Twine Name(bb->index);
-    BB->setName("<bb " + Name + ">");
-  }
+  if (stmt && gimple_code (stmt) == GIMPLE_LABEL)
+    if (tree name = DECL_NAME(gimple_label_label(stmt))) {
+      BB->setName(IDENTIFIER_POINTER(name));
+      return BB;
+    }
 
-  return BasicBlocks[bb] = BB;
+  // Use the same basic block naming scheme as the GCC tree dumps.
+  Twine Name(bb->index);
+  BB->setName("<bb " + Name + ">");
+  return BB;
 }
 
 /// getLabelDeclBlock - Lazily get and create a basic block for the specified





More information about the llvm-commits mailing list