[llvm] r175139 - R600/SI: Check for empty stack in SIAnnotateControlFlow::isTopOfStack

Michel Danzer michel.daenzer at amd.com
Thu Feb 14 00:00:33 PST 2013


Author: daenzer
Date: Thu Feb 14 02:00:33 2013
New Revision: 175139

URL: http://llvm.org/viewvc/llvm-project?rev=175139&view=rev
Log:
R600/SI: Check for empty stack in SIAnnotateControlFlow::isTopOfStack

Fixes assertion failure in newly added lit test. Might just be a bandaid that
needs to be revisited.

Modified:
    llvm/trunk/lib/Target/R600/SIAnnotateControlFlow.cpp

Modified: llvm/trunk/lib/Target/R600/SIAnnotateControlFlow.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIAnnotateControlFlow.cpp?rev=175139&r1=175138&r2=175139&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SIAnnotateControlFlow.cpp (original)
+++ llvm/trunk/lib/Target/R600/SIAnnotateControlFlow.cpp Thu Feb 14 02:00:33 2013
@@ -147,7 +147,7 @@ bool SIAnnotateControlFlow::doInitializa
 
 /// \brief Is BB the last block saved on the stack ?
 bool SIAnnotateControlFlow::isTopOfStack(BasicBlock *BB) {
-  return Stack.back().first == BB;
+  return !Stack.empty() && Stack.back().first == BB;
 }
 
 /// \brief Pop the last saved value from the control flow stack





More information about the llvm-commits mailing list