[llvm-commits] [llvm] r133113 - in /llvm/trunk: lib/CodeGen/EdgeBundles.cpp test/CodeGen/Generic/edge-bundles-blockIDs.c
Anna Zaks
ganna at apple.com
Wed Jun 15 17:03:21 PDT 2011
Author: zaks
Date: Wed Jun 15 19:03:21 2011
New Revision: 133113
URL: http://llvm.org/viewvc/llvm-project?rev=133113&view=rev
Log:
Function::getNumBlockIDs() should be used instead of Function::size() to set the upper limit on the block IDs since basic blocks might get removed (simplified away) after being initially numbered. Plus the test case, in which SelectionDAGBuilder::visitBr() calls llvm::MachineFunction::removeFromMBBNumbering(), which introduces the hole in numbering leading to an assert in llc (prior to the fix).
Added:
llvm/trunk/test/CodeGen/Generic/edge-bundles-blockIDs.c
Modified:
llvm/trunk/lib/CodeGen/EdgeBundles.cpp
Modified: llvm/trunk/lib/CodeGen/EdgeBundles.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/EdgeBundles.cpp?rev=133113&r1=133112&r2=133113&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/EdgeBundles.cpp (original)
+++ llvm/trunk/lib/CodeGen/EdgeBundles.cpp Wed Jun 15 19:03:21 2011
@@ -39,7 +39,7 @@
bool EdgeBundles::runOnMachineFunction(MachineFunction &mf) {
MF = &mf;
EC.clear();
- EC.grow(2 * MF->size());
+ EC.grow(2 * MF->getNumBlockIDs());
for (MachineFunction::const_iterator I = MF->begin(), E = MF->end(); I != E;
++I) {
Added: llvm/trunk/test/CodeGen/Generic/edge-bundles-blockIDs.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/edge-bundles-blockIDs.c?rev=133113&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/edge-bundles-blockIDs.c (added)
+++ llvm/trunk/test/CodeGen/Generic/edge-bundles-blockIDs.c Wed Jun 15 19:03:21 2011
@@ -0,0 +1,81 @@
+; Make sure EdgeBoundles handles the case when the function size is less then
+; the number of block IDs.
+; RUN: llc -regalloc=fast < %s
+
+define void @WIn9UJ86JKdV4dM() nounwind {
+entry:
+ br i1 undef, label %bb5.i1632, label %bb1.i1605
+
+bb1.i1605: ; preds = %entry
+ br i1 undef, label %bb5.i73.i, label %bb3.i68.i
+
+bb3.i68.i: ; preds = %bb1.i1605
+ unreachable
+
+bb5.i73.i: ; preds = %bb1.i1605
+ br i1 undef, label %bb7.i79.i, label %bb6.i76.i
+
+bb6.i76.i: ; preds = %bb5.i73.i
+ unreachable
+
+bb7.i79.i: ; preds = %bb5.i73.i
+ br i1 undef, label %bb.i.i1608, label %bb8.i82.i
+
+bb8.i82.i: ; preds = %bb7.i79.i
+ unreachable
+
+bb.i.i1608: ; preds = %bb.i.i1608, %bb7.i79.i
+ br i1 undef, label %bb1.i.dhGetPoolFolder_dispatcher.preheader_crit_edge.i, label %bb.i.i1608
+
+bb1.i.dhGetPoolFolder_dispatcher.preheader_crit_edge.i: ; preds = %bb.i.i1608
+ br label %dhGetPoolFolder_dispatcher.i
+
+bb3.i.i1610: ; preds = %bb8.i.i, %bb7.i.i1615
+ br i1 undef, label %bb5.i.i1613, label %bb4.i.i1611
+
+bb4.i.i1611: ; preds = %bb3.i.i1610
+ br label %bb5.i.i1613
+
+bb5.i.i1613: ; preds = %bb4.i.i1611, %bb3.i.i1610
+ unreachable
+
+bb7.i.i1615: ; preds = %dhGetPoolFolder.exit.i
+ br i1 undef, label %bb3.i.i1610, label %bb8.i.i
+
+bb8.i.i: ; preds = %bb7.i.i1615
+ br i1 undef, label %bb3.i.i1610, label %bb9.i.i
+
+bb9.i.i: ; preds = %bb8.i.i
+ br label %bb12.i.i
+
+bb12.i.i: ; preds = %bb12.i.i, %bb9.i.i
+ br i1 undef, label %bb13.i.bb14.i_crit_edge.i, label %bb12.i.i
+
+bb13.i.bb14.i_crit_edge.i: ; preds = %bb12.i.i
+ br i1 undef, label %bb25.i.i, label %bb20.i.i
+
+bb19.i.i: ; preds = %bb20.i.i
+ br label %bb20.i.i
+
+bb20.i.i: ; preds = %bb19.i.i, %bb13.i.bb14.i_crit_edge.i
+ %or.cond.i = or i1 undef, undef
+ br i1 %or.cond.i, label %bb25.i.i, label %bb19.i.i
+
+bb25.i.i: ; preds = %bb20.i.i, %bb13.i.bb14.i_crit_edge.i
+ unreachable
+
+bb5.i1632: ; preds = %entry
+ unreachable
+
+dhGetPoolFolder_dispatcher.i: ; preds = %dhGetPoolFolder.exit.i, %bb1.i.dhGetPoolFolder_dispatcher.preheader_crit_edge.i
+ br i1 undef, label %bb.i96.i, label %bb1.i102.i
+
+bb.i96.i: ; preds = %dhGetPoolFolder_dispatcher.i
+ br label %dhGetPoolFolder.exit.i
+
+bb1.i102.i: ; preds = %dhGetPoolFolder_dispatcher.i
+ br label %dhGetPoolFolder.exit.i
+
+dhGetPoolFolder.exit.i: ; preds = %bb1.i102.i, %bb.i96.i
+ br i1 undef, label %bb7.i.i1615, label %dhGetPoolFolder_dispatcher.i
+}
More information about the llvm-commits
mailing list