[llvm-commits] [llvm] r128434 - in /llvm/trunk: lib/CodeGen/StackProtector.cpp test/CodeGen/X86/crash.ll

Bill Wendling isanbard at gmail.com
Mon Mar 28 16:02:18 PDT 2011


Author: void
Date: Mon Mar 28 18:02:18 2011
New Revision: 128434

URL: http://llvm.org/viewvc/llvm-project?rev=128434&view=rev
Log:
In some cases, the "fail BB dominator" may be null after the BB was split (and
becomes reachable when before it wasn't). Check to make sure that it's not null
before trying to use it.

Modified:
    llvm/trunk/lib/CodeGen/StackProtector.cpp
    llvm/trunk/test/CodeGen/X86/crash.ll

Modified: llvm/trunk/lib/CodeGen/StackProtector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=128434&r1=128433&r2=128434&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StackProtector.cpp (original)
+++ llvm/trunk/lib/CodeGen/StackProtector.cpp Mon Mar 28 18:02:18 2011
@@ -221,7 +221,8 @@
     BasicBlock *NewBB = BB->splitBasicBlock(RI, "SP_return");
     if (DT && DT->isReachableFromEntry(BB)) {
       DT->addNewBlock(NewBB, BB);
-      FailBBDom = DT->findNearestCommonDominator(FailBBDom, BB);
+      if (FailBBDom)
+        FailBBDom = DT->findNearestCommonDominator(FailBBDom, BB);
     }
 
     // Remove default branch instruction to the new BB.

Modified: llvm/trunk/test/CodeGen/X86/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/crash.ll?rev=128434&r1=128433&r2=128434&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/crash.ll (original)
+++ llvm/trunk/test/CodeGen/X86/crash.ll Mon Mar 28 18:02:18 2011
@@ -189,7 +189,7 @@
 }
 
 ; PR9028
-define void @f(i64 %A) nounwind {
+define void @func_60(i64 %A) nounwind {
 entry:
   %0 = zext i64 %A to i160
   %1 = shl i160 %0, 64
@@ -199,3 +199,19 @@
   store i576 %4, i576* undef, align 8
   ret void
 }
+
+; <rdar://problem/9187792>
+define fastcc void @func_61() nounwind sspreq {
+entry:
+  %t1 = tail call i64 @llvm.objectsize.i64(i8* undef, i1 false)
+  %t2 = icmp eq i64 %t1, -1
+  br i1 %t2, label %bb2, label %bb1
+
+bb1:
+  ret void
+
+bb2:
+  ret void
+}
+
+declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readnone





More information about the llvm-commits mailing list