R600/SI: Check for empty stack in SIAnnotateControlFlow::isTopOfStack
authorMichel Danzer <michel.daenzer@amd.com>
Thu, 14 Feb 2013 08:00:33 +0000 (08:00 +0000)
committerMichel Danzer <michel.daenzer@amd.com>
Thu, 14 Feb 2013 08:00:33 +0000 (08:00 +0000)
Fixes assertion failure in newly added lit test. Might just be a bandaid that
needs to be revisited.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175139 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/R600/SIAnnotateControlFlow.cpp

index f58037741861251f487f47bffaf8de7f51318d7c..2477e2a9dcc33b5435b884c887e395d2006304a4 100644 (file)
@@ -147,7 +147,7 @@ bool SIAnnotateControlFlow::doInitialization(Module &M) {
 
 /// \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