[stackprotector] Small Bit of computation hoisting.
authorMichael Gottesman <mgottesman@apple.com>
Tue, 20 Aug 2013 08:56:26 +0000 (08:56 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Tue, 20 Aug 2013 08:56:26 +0000 (08:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188771 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/StackProtector.cpp

index 2cd2219ac920588c9faffe406a5b16c8a5984b11..86ca53dba45f4c0514cc5a12507d23bf236b9939 100644 (file)
@@ -387,7 +387,8 @@ static bool CreatePrologue(Function *F, Module *M, ReturnInst *RI,
 ///    value. It calls __stack_chk_fail if they differ.
 bool StackProtector::InsertStackProtectors() {
   bool HasPrologue = false;
-  bool SupportsSelectionDAGSP = false;
+  bool SupportsSelectionDAGSP =
+    EnableSelectionDAGSP && !TM->Options.EnableFastISel;
   AllocaInst *AI = 0;           // Place on stack that stores the stack guard.
   Value *StackGuardVar = 0;     // The stack guard variable.
 
@@ -398,12 +399,11 @@ bool StackProtector::InsertStackProtectors() {
 
     if (!HasPrologue) {
       HasPrologue = true;
-      SupportsSelectionDAGSP = CreatePrologue(F, M, RI, TLI, Trip, AI,
-                                              StackGuardVar);
+      SupportsSelectionDAGSP &= CreatePrologue(F, M, RI, TLI, Trip, AI,
+                                               StackGuardVar);
     }
 
-    if (EnableSelectionDAGSP && !TM->Options.EnableFastISel &&
-        SupportsSelectionDAGSP) {
+    if (SupportsSelectionDAGSP) {
       // Since we have a potential tail call, insert the special stack check
       // intrinsic.
       Instruction *InsertionPt = 0;