[llvm] [CodeGen] Port SafeStack to new pass manager (PR #73747)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 01:35:05 PST 2023


https://github.com/paperchalice updated https://github.com/llvm/llvm-project/pull/73747

>From 04300ef0b233aafdfdd1a25940d202a4e5aacd75 Mon Sep 17 00:00:00 2001
From: PaperChalice <29250197+paperchalice at users.noreply.github.com>
Date: Tue, 28 Nov 2023 20:59:09 +0800
Subject: [PATCH] [CodeGen] Port SafeStack to new pass manager

---
 llvm/include/llvm/CodeGen/SafeStack.h         | 28 ++++++++++++++
 llvm/lib/CodeGen/SafeStack.cpp                | 37 +++++++++++++++++++
 llvm/lib/Passes/PassBuilder.cpp               |  1 +
 llvm/lib/Passes/PassRegistry.def              |  1 +
 llvm/test/Transforms/SafeStack/AArch64/abi.ll |  1 +
 .../Transforms/SafeStack/AArch64/abi_ssp.ll   |  2 +
 .../SafeStack/AArch64/unreachable.ll          |  1 +
 llvm/test/Transforms/SafeStack/ARM/abi.ll     |  1 +
 llvm/test/Transforms/SafeStack/ARM/debug.ll   |  1 +
 llvm/test/Transforms/SafeStack/ARM/setjmp.ll  |  1 +
 llvm/test/Transforms/SafeStack/X86/abi.ll     |  4 ++
 llvm/test/Transforms/SafeStack/X86/abi_ssp.ll | 11 ++++++
 .../Transforms/SafeStack/X86/addr-taken.ll    |  2 +
 .../Transforms/SafeStack/X86/array-aligned.ll |  2 +
 llvm/test/Transforms/SafeStack/X86/array.ll   |  2 +
 llvm/test/Transforms/SafeStack/X86/byval.ll   |  2 +
 llvm/test/Transforms/SafeStack/X86/call.ll    |  2 +
 llvm/test/Transforms/SafeStack/X86/cast.ll    |  2 +
 .../Transforms/SafeStack/X86/coloring-ssp.ll  |  1 +
 .../test/Transforms/SafeStack/X86/coloring.ll |  2 +
 .../Transforms/SafeStack/X86/coloring2.ll     |  2 +
 .../SafeStack/X86/constant-gep-call.ll        |  2 +
 .../Transforms/SafeStack/X86/constant-gep.ll  |  2 +
 .../Transforms/SafeStack/X86/constant-geps.ll |  2 +
 .../SafeStack/X86/debug-loc-dynamic.ll        |  2 +
 .../Transforms/SafeStack/X86/debug-loc.ll     |  2 +
 .../Transforms/SafeStack/X86/debug-loc2.ll    |  2 +
 .../SafeStack/X86/dynamic-alloca.ll           |  2 +
 .../SafeStack/X86/escape-addr-pointer.ll      |  2 +
 .../SafeStack/X86/escape-bitcast-store.ll     |  2 +
 .../SafeStack/X86/escape-bitcast-store2.ll    |  2 +
 .../Transforms/SafeStack/X86/escape-call.ll   |  2 +
 .../SafeStack/X86/escape-casted-pointer.ll    |  2 +
 .../SafeStack/X86/escape-gep-call.ll          |  2 +
 .../SafeStack/X86/escape-gep-invoke.ll        |  2 +
 .../SafeStack/X86/escape-gep-negative.ll      |  2 +
 .../SafeStack/X86/escape-gep-ptrtoint.ll      |  2 +
 .../SafeStack/X86/escape-gep-store.ll         |  2 +
 .../SafeStack/X86/escape-phi-call.ll          |  2 +
 .../SafeStack/X86/escape-select-call.ll       |  2 +
 .../Transforms/SafeStack/X86/escape-vector.ll |  2 +
 llvm/test/Transforms/SafeStack/X86/invoke.ll  |  2 +
 .../Transforms/SafeStack/X86/layout-frag.ll   |  1 +
 .../SafeStack/X86/layout-region-split.ll      |  1 +
 .../SafeStack/X86/memintrinsic-oob-read.ll    |  2 +
 .../test/Transforms/SafeStack/X86/musttail.ll |  1 +
 llvm/test/Transforms/SafeStack/X86/no-attr.ll |  2 +
 .../SafeStack/X86/no-crash-on-lifetime.ll     |  1 +
 .../Transforms/SafeStack/X86/phi-cycle.ll     |  2 +
 llvm/test/Transforms/SafeStack/X86/phi.ll     |  2 +
 llvm/test/Transforms/SafeStack/X86/pr54784.ll |  1 +
 llvm/test/Transforms/SafeStack/X86/ret.ll     |  2 +
 llvm/test/Transforms/SafeStack/X86/setjmp.ll  |  2 +
 llvm/test/Transforms/SafeStack/X86/setjmp2.ll |  2 +
 .../Transforms/SafeStack/X86/sink-to-use.ll   |  2 +
 llvm/test/Transforms/SafeStack/X86/ssp.ll     |  1 +
 llvm/test/Transforms/SafeStack/X86/store.ll   |  2 +
 llvm/test/Transforms/SafeStack/X86/struct.ll  |  2 +
 58 files changed, 174 insertions(+)
 create mode 100644 llvm/include/llvm/CodeGen/SafeStack.h

diff --git a/llvm/include/llvm/CodeGen/SafeStack.h b/llvm/include/llvm/CodeGen/SafeStack.h
new file mode 100644
index 000000000000000..e8f0d141457ba68
--- /dev/null
+++ b/llvm/include/llvm/CodeGen/SafeStack.h
@@ -0,0 +1,28 @@
+//===--------------------- llvm/CodeGen/SafeStack.h -------------*- C++-*--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_SAFESTACK_H
+#define LLVM_CODEGEN_SAFESTACK_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+class TargetMachine;
+
+class SafeStackPass : public PassInfoMixin<SafeStackPass> {
+  const TargetMachine *TM;
+
+public:
+  explicit SafeStackPass(const TargetMachine *TM_) : TM(TM_) {}
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+};
+
+} // namespace llvm
+
+#endif // LLVM_CODEGEN_SAFESTACK_H
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp
index 368e6933f83b31c..a33fffc1044fc2c 100644
--- a/llvm/lib/CodeGen/SafeStack.cpp
+++ b/llvm/lib/CodeGen/SafeStack.cpp
@@ -14,6 +14,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/CodeGen/SafeStack.h"
 #include "SafeStackLayout.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/ArrayRef.h"
@@ -927,6 +928,42 @@ class SafeStackLegacyPass : public FunctionPass {
 
 } // end anonymous namespace
 
+PreservedAnalyses SafeStackPass::run(Function &F,
+                                     FunctionAnalysisManager &FAM) {
+  LLVM_DEBUG(dbgs() << "[SafeStack] Function: " << F.getName() << "\n");
+
+  if (!F.hasFnAttribute(Attribute::SafeStack)) {
+    LLVM_DEBUG(dbgs() << "[SafeStack]     safestack is not requested"
+                         " for this function\n");
+    return PreservedAnalyses::all();
+  }
+
+  if (F.isDeclaration()) {
+    LLVM_DEBUG(dbgs() << "[SafeStack]     function definition"
+                         " is not available\n");
+    return PreservedAnalyses::all();
+  }
+
+  auto *TL = TM->getSubtargetImpl(F)->getTargetLowering();
+  if (!TL)
+    report_fatal_error("TargetLowering instance is required");
+
+  auto &DL = F.getParent()->getDataLayout();
+
+  // preserve DominatorTree
+  auto &DT = FAM.getResult<DominatorTreeAnalysis>(F);
+  auto &SE = FAM.getResult<ScalarEvolutionAnalysis>(F);
+  DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
+
+  bool Changed = SafeStack(F, *TL, DL, &DTU, SE).run();
+
+  if (!Changed)
+    return PreservedAnalyses::all();
+  PreservedAnalyses PA;
+  PA.preserve<DominatorTreeAnalysis>();
+  return PA;
+}
+
 char SafeStackLegacyPass::ID = 0;
 
 INITIALIZE_PASS_BEGIN(SafeStackLegacyPass, DEBUG_TYPE,
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index aeb9726a186b51e..76326fecb807888 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -77,6 +77,7 @@
 #include "llvm/CodeGen/ExpandLargeDivRem.h"
 #include "llvm/CodeGen/ExpandLargeFpConvert.h"
 #include "llvm/CodeGen/HardwareLoops.h"
+#include "llvm/CodeGen/SafeStack.h"
 #include "llvm/CodeGen/TypePromotion.h"
 #include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/Dominators.h"
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 1f1bc3222468b8a..b4c69ad63c4e76e 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -393,6 +393,7 @@ FUNCTION_PASS("print<uniformity>", UniformityInfoPrinterPass(dbgs()))
 FUNCTION_PASS("reassociate", ReassociatePass())
 FUNCTION_PASS("redundant-dbg-inst-elim", RedundantDbgInstEliminationPass())
 FUNCTION_PASS("reg2mem", RegToMemPass())
+FUNCTION_PASS("safe-stack", SafeStackPass(TM))
 FUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass())
 FUNCTION_PASS("scalarizer", ScalarizerPass())
 FUNCTION_PASS("sccp", SCCPPass())
diff --git a/llvm/test/Transforms/SafeStack/AArch64/abi.ll b/llvm/test/Transforms/SafeStack/AArch64/abi.ll
index 18cf49920ace638..6d4ca03096825e6 100644
--- a/llvm/test/Transforms/SafeStack/AArch64/abi.ll
+++ b/llvm/test/Transforms/SafeStack/AArch64/abi.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
 
 
 define void @foo() nounwind uwtable safestack {
diff --git a/llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll b/llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll
index aab2d5dd4a7813e..282d8c4390b6535 100644
--- a/llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll
+++ b/llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck --check-prefixes=TLS,ANDROID %s
 ; RUN: opt -safe-stack -S -mtriple=aarch64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=TLS,FUCHSIA %s
+; RUN: opt -passes=safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck --check-prefixes=TLS,ANDROID %s
+; RUN: opt -passes=safe-stack -S -mtriple=aarch64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=TLS,FUCHSIA %s
 
 define void @foo() nounwind uwtable safestack sspreq {
 entry:
diff --git a/llvm/test/Transforms/SafeStack/AArch64/unreachable.ll b/llvm/test/Transforms/SafeStack/AArch64/unreachable.ll
index 430c4aa7ae4532d..23fd3bf9d8f21ec 100644
--- a/llvm/test/Transforms/SafeStack/AArch64/unreachable.ll
+++ b/llvm/test/Transforms/SafeStack/AArch64/unreachable.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -safe-stack -safe-stack-coloring -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -safe-stack-coloring -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
 
 define void @foo() nounwind uwtable safestack {
 entry:
diff --git a/llvm/test/Transforms/SafeStack/ARM/abi.ll b/llvm/test/Transforms/SafeStack/ARM/abi.ll
index be4e2e35f976959..5584dedf697efdc 100644
--- a/llvm/test/Transforms/SafeStack/ARM/abi.ll
+++ b/llvm/test/Transforms/SafeStack/ARM/abi.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -safe-stack -S -mtriple=arm-linux-android < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=arm-linux-android < %s -o - | FileCheck %s
 
 
 define void @foo() nounwind uwtable safestack {
diff --git a/llvm/test/Transforms/SafeStack/ARM/debug.ll b/llvm/test/Transforms/SafeStack/ARM/debug.ll
index 9a61b78d2d9660e..c38ee62fa6aa49e 100644
--- a/llvm/test/Transforms/SafeStack/ARM/debug.ll
+++ b/llvm/test/Transforms/SafeStack/ARM/debug.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -safe-stack -safestack-use-pointer-address < %s -S | FileCheck %s
+; RUN: opt -passes=safe-stack -safestack-use-pointer-address < %s -S | FileCheck %s
 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
 target triple = "armv7-pc-linux-android"
 
diff --git a/llvm/test/Transforms/SafeStack/ARM/setjmp.ll b/llvm/test/Transforms/SafeStack/ARM/setjmp.ll
index b86e778aabb1645..8da5f3549a4cf43 100644
--- a/llvm/test/Transforms/SafeStack/ARM/setjmp.ll
+++ b/llvm/test/Transforms/SafeStack/ARM/setjmp.ll
@@ -1,5 +1,6 @@
 ; Test stack pointer restore after setjmp() with the function-call safestack ABI.
 ; RUN: opt -safe-stack -S -mtriple=arm-linux-androideabi < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=arm-linux-androideabi < %s -o - | FileCheck %s
 
 @env = global [64 x i32] zeroinitializer, align 4
 
diff --git a/llvm/test/Transforms/SafeStack/X86/abi.ll b/llvm/test/Transforms/SafeStack/X86/abi.ll
index 37d8ea6a67f5072..2afee3b2f342acf 100644
--- a/llvm/test/Transforms/SafeStack/X86/abi.ll
+++ b/llvm/test/Transforms/SafeStack/X86/abi.ll
@@ -2,6 +2,10 @@
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
 ; RUN: opt -safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS32
 ; RUN: opt -safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS64
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
+; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS32
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS64
 
 
 define void @foo() nounwind uwtable safestack {
diff --git a/llvm/test/Transforms/SafeStack/X86/abi_ssp.ll b/llvm/test/Transforms/SafeStack/X86/abi_ssp.ll
index 7cb754999c65788..e66127533d38d6b 100644
--- a/llvm/test/Transforms/SafeStack/X86/abi_ssp.ll
+++ b/llvm/test/Transforms/SafeStack/X86/abi_ssp.ll
@@ -8,6 +8,17 @@
 
 ; RUN: opt -safe-stack -S -mtriple=x86_64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=COMMON,FUCHSIA64 %s
 
+; RUN: opt -passes=safe-stack -S -mtriple=i686-pc-linux-gnu < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefixes=COMMON,TLS64 %s
+
+; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,GLOBAL32 %s
+; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android24 < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
+
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,TLS64 %s
+
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=COMMON,FUCHSIA64 %s
+
+
 define void @foo() safestack sspreq {
 entry:
 ; TLS32: %[[StackGuard:.*]] = load ptr, ptr addrspace(256) inttoptr (i32 20 to ptr addrspace(256))
diff --git a/llvm/test/Transforms/SafeStack/X86/addr-taken.ll b/llvm/test/Transforms/SafeStack/X86/addr-taken.ll
index cd9f76217a45851..7bbe9f4743d1ef1 100644
--- a/llvm/test/Transforms/SafeStack/X86/addr-taken.ll
+++ b/llvm/test/Transforms/SafeStack/X86/addr-taken.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/array-aligned.ll b/llvm/test/Transforms/SafeStack/X86/array-aligned.ll
index ed05d387b511fd2..509e50072b994de 100644
--- a/llvm/test/Transforms/SafeStack/X86/array-aligned.ll
+++ b/llvm/test/Transforms/SafeStack/X86/array-aligned.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/array.ll b/llvm/test/Transforms/SafeStack/X86/array.ll
index 2bc57be3dd6a29d..e773e375529dbe0 100644
--- a/llvm/test/Transforms/SafeStack/X86/array.ll
+++ b/llvm/test/Transforms/SafeStack/X86/array.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 ; array [4 x i8]
 ; Requires protector.
diff --git a/llvm/test/Transforms/SafeStack/X86/byval.ll b/llvm/test/Transforms/SafeStack/X86/byval.ll
index 761265e279d4108..29c6e22b7a278d0 100644
--- a/llvm/test/Transforms/SafeStack/X86/byval.ll
+++ b/llvm/test/Transforms/SafeStack/X86/byval.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/Transforms/SafeStack/X86/call.ll b/llvm/test/Transforms/SafeStack/X86/call.ll
index bb1b46275e1cdf4..9592b33b620ba64 100644
--- a/llvm/test/Transforms/SafeStack/X86/call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/call.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/Transforms/SafeStack/X86/cast.ll b/llvm/test/Transforms/SafeStack/X86/cast.ll
index 41f01c3b576ae4f..629cd61993d3ce7 100644
--- a/llvm/test/Transforms/SafeStack/X86/cast.ll
+++ b/llvm/test/Transforms/SafeStack/X86/cast.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll b/llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll
index 032ffd1994772b6..8ff369ef063e317 100644
--- a/llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll
+++ b/llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 ; %x and %y share a stack slot between them, but not with the stack guard.
 define void @f() safestack sspreq {
diff --git a/llvm/test/Transforms/SafeStack/X86/coloring.ll b/llvm/test/Transforms/SafeStack/X86/coloring.ll
index 37bdccffd0c3304..22e1487bdcfce7a 100644
--- a/llvm/test/Transforms/SafeStack/X86/coloring.ll
+++ b/llvm/test/Transforms/SafeStack/X86/coloring.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 define void @f() safestack {
 entry:
diff --git a/llvm/test/Transforms/SafeStack/X86/coloring2.ll b/llvm/test/Transforms/SafeStack/X86/coloring2.ll
index b2f59906b6036f8..2e02ea66f9c76f2 100644
--- a/llvm/test/Transforms/SafeStack/X86/coloring2.ll
+++ b/llvm/test/Transforms/SafeStack/X86/coloring2.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 ; x and y share the stack slot.
 define void @f() safestack {
diff --git a/llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll b/llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll
index 880471a8a63d91c..074977b27f66170 100644
--- a/llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.nest = type { %struct.pair, %struct.pair }
 %struct.pair = type { i32, i32 }
diff --git a/llvm/test/Transforms/SafeStack/X86/constant-gep.ll b/llvm/test/Transforms/SafeStack/X86/constant-gep.ll
index 935c3624e387ada..88429ca5304e634 100644
--- a/llvm/test/Transforms/SafeStack/X86/constant-gep.ll
+++ b/llvm/test/Transforms/SafeStack/X86/constant-gep.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %class.A = type { [2 x i8] }
 
diff --git a/llvm/test/Transforms/SafeStack/X86/constant-geps.ll b/llvm/test/Transforms/SafeStack/X86/constant-geps.ll
index fd099db5f943e21..fe05d0ed17f320d 100644
--- a/llvm/test/Transforms/SafeStack/X86/constant-geps.ll
+++ b/llvm/test/Transforms/SafeStack/X86/constant-geps.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.deep = type { %union.anon }
 %union.anon = type { %struct.anon }
diff --git a/llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll b/llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll
index b5d862b03b623f5..42d2aa91307f027 100644
--- a/llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll
+++ b/llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
 
 ; Test llvm.dbg.value for dynamic allocas moved onto the unsafe stack.
 ; In the dynamic alloca case, the dbg.value does not change with the exception
diff --git a/llvm/test/Transforms/SafeStack/X86/debug-loc.ll b/llvm/test/Transforms/SafeStack/X86/debug-loc.ll
index 41240f7d7a916f3..9a4df89f37b0aba 100644
--- a/llvm/test/Transforms/SafeStack/X86/debug-loc.ll
+++ b/llvm/test/Transforms/SafeStack/X86/debug-loc.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
 
 ; Test debug location for the local variables moved onto the unsafe stack.
 
diff --git a/llvm/test/Transforms/SafeStack/X86/debug-loc2.ll b/llvm/test/Transforms/SafeStack/X86/debug-loc2.ll
index a7164ef0f45c309..915126bc3bbe30c 100644
--- a/llvm/test/Transforms/SafeStack/X86/debug-loc2.ll
+++ b/llvm/test/Transforms/SafeStack/X86/debug-loc2.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
 
 ; Test llvm.dbg.value for the local variables moved onto the unsafe stack.
 ; SafeStack rewrites them relative to the unsafe stack pointer (base address of
diff --git a/llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll b/llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll
index d8377781bb6e5ef..a8dec20973babb6 100644
--- a/llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll
+++ b/llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll b/llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll
index a650ee9661f06e0..42448fb62024ef4 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll b/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll
index bde9c3a21964c88..23a8edf4afceb22 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll b/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll
index 8dd1233cd023093..1a3c8ac215e0b27 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-call.ll b/llvm/test/Transforms/SafeStack/X86/escape-call.ll
index 9af891e3f62e4a2..1d87cae526836c3 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-call.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll b/llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll
index d482f0c8263f679..9ca0fd39fbabddd 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll
index 759dc5d1cb1abe2..60e4f91ed61eea2 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.pair = type { i32, i32 }
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll
index d09a3d85d39e592..db69fbfd38f6272 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.pair = type { i32, i32 }
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-negative.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-negative.ll
index 896cae9621056f1..96625c5aaad8cae 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-negative.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-negative.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-ptrtoint.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-ptrtoint.ll
index 60783b8d657ac5f..8a38781981afa90 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-ptrtoint.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-ptrtoint.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.pair = type { i32, i32 }
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-gep-store.ll b/llvm/test/Transforms/SafeStack/X86/escape-gep-store.ll
index b7dad0eb34baebc..a2693ca767025c7 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-gep-store.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-gep-store.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.pair = type { i32, i32 }
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-phi-call.ll b/llvm/test/Transforms/SafeStack/X86/escape-phi-call.ll
index 1dd5d6e0d9274e8..57e116834ab04ec 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-phi-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-phi-call.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-select-call.ll b/llvm/test/Transforms/SafeStack/X86/escape-select-call.ll
index 5d1046ca96602a4..67b284aa1d1dffe 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-select-call.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-select-call.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/escape-vector.ll b/llvm/test/Transforms/SafeStack/X86/escape-vector.ll
index c725ba922cf0e18..055f558c966ebd2 100644
--- a/llvm/test/Transforms/SafeStack/X86/escape-vector.ll
+++ b/llvm/test/Transforms/SafeStack/X86/escape-vector.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.vec = type { <4 x i32> }
 
diff --git a/llvm/test/Transforms/SafeStack/X86/invoke.ll b/llvm/test/Transforms/SafeStack/X86/invoke.ll
index 5385169950cc3d8..23d935eb06acc9b 100644
--- a/llvm/test/Transforms/SafeStack/X86/invoke.ll
+++ b/llvm/test/Transforms/SafeStack/X86/invoke.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/layout-frag.ll b/llvm/test/Transforms/SafeStack/X86/layout-frag.ll
index 19c3855bc1cb8f0..b858fd613153765 100644
--- a/llvm/test/Transforms/SafeStack/X86/layout-frag.ll
+++ b/llvm/test/Transforms/SafeStack/X86/layout-frag.ll
@@ -1,5 +1,6 @@
 ; Test that safestack layout reuses a region w/o fragmentation.
 ; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 define void @f() safestack {
 ; CHECK-LABEL: define void @f
diff --git a/llvm/test/Transforms/SafeStack/X86/layout-region-split.ll b/llvm/test/Transforms/SafeStack/X86/layout-region-split.ll
index 3bee85527f824ac..b126fdff204ff37 100644
--- a/llvm/test/Transforms/SafeStack/X86/layout-region-split.ll
+++ b/llvm/test/Transforms/SafeStack/X86/layout-region-split.ll
@@ -1,5 +1,6 @@
 ; Regression test for safestack layout. Used to fail with asan.
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 define void @f() safestack {
 ; CHECK-LABEL: define void @f
diff --git a/llvm/test/Transforms/SafeStack/X86/memintrinsic-oob-read.ll b/llvm/test/Transforms/SafeStack/X86/memintrinsic-oob-read.ll
index 9bc247ed6c509e5..75e40ad6921db78 100644
--- a/llvm/test/Transforms/SafeStack/X86/memintrinsic-oob-read.ll
+++ b/llvm/test/Transforms/SafeStack/X86/memintrinsic-oob-read.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/Transforms/SafeStack/X86/musttail.ll b/llvm/test/Transforms/SafeStack/X86/musttail.ll
index 32bc6674a2a22b1..a6e127924bf51c9 100644
--- a/llvm/test/Transforms/SafeStack/X86/musttail.ll
+++ b/llvm/test/Transforms/SafeStack/X86/musttail.ll
@@ -1,6 +1,7 @@
 ; To test that safestack does not break the musttail call contract.
 ;
 ; RUN: opt < %s --safe-stack -S | FileCheck %s
+; RUN: opt < %s -passes=safe-stack -S | FileCheck %s
 
 target triple = "x86_64-unknown-linux-gnu"
 
diff --git a/llvm/test/Transforms/SafeStack/X86/no-attr.ll b/llvm/test/Transforms/SafeStack/X86/no-attr.ll
index 7715ca59f16887f..1a292b5a84b3b74 100644
--- a/llvm/test/Transforms/SafeStack/X86/no-attr.ll
+++ b/llvm/test/Transforms/SafeStack/X86/no-attr.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/no-crash-on-lifetime.ll b/llvm/test/Transforms/SafeStack/X86/no-crash-on-lifetime.ll
index 45e9fa3c2e3fc21..76c638ebbd21191 100644
--- a/llvm/test/Transforms/SafeStack/X86/no-crash-on-lifetime.ll
+++ b/llvm/test/Transforms/SafeStack/X86/no-crash-on-lifetime.ll
@@ -1,5 +1,6 @@
 ; Check that the pass does not crash on the code.
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu %s -o /dev/null
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu %s -o /dev/null
 
 %class.F = type { %class.o, i8, [7 x i8] }
 %class.o = type <{ ptr, i32, [4 x i8] }>
diff --git a/llvm/test/Transforms/SafeStack/X86/phi-cycle.ll b/llvm/test/Transforms/SafeStack/X86/phi-cycle.ll
index 18e6a7d50fe43bf..cca87af96ccfd84 100644
--- a/llvm/test/Transforms/SafeStack/X86/phi-cycle.ll
+++ b/llvm/test/Transforms/SafeStack/X86/phi-cycle.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.small = type { i8 }
 
diff --git a/llvm/test/Transforms/SafeStack/X86/phi.ll b/llvm/test/Transforms/SafeStack/X86/phi.ll
index 18380431f639884..8f0023edd54a9bd 100644
--- a/llvm/test/Transforms/SafeStack/X86/phi.ll
+++ b/llvm/test/Transforms/SafeStack/X86/phi.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 define void @f(i1 %d1, i1 %d2) safestack {
 entry:
diff --git a/llvm/test/Transforms/SafeStack/X86/pr54784.ll b/llvm/test/Transforms/SafeStack/X86/pr54784.ll
index 940f56004e810f2..398a5384806376a 100644
--- a/llvm/test/Transforms/SafeStack/X86/pr54784.ll
+++ b/llvm/test/Transforms/SafeStack/X86/pr54784.ll
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -S -safe-stack < %s | FileCheck %s
+; RUN: opt -S -passes=safe-stack < %s | FileCheck %s
 
 target triple = "x86_64-unknown-unknown"
 
diff --git a/llvm/test/Transforms/SafeStack/X86/ret.ll b/llvm/test/Transforms/SafeStack/X86/ret.ll
index b8a3e0569d49235..40ed6f50d4d2886 100644
--- a/llvm/test/Transforms/SafeStack/X86/ret.ll
+++ b/llvm/test/Transforms/SafeStack/X86/ret.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/setjmp.ll b/llvm/test/Transforms/SafeStack/X86/setjmp.ll
index 64a39e081631638..e3003ccd9b86459 100644
--- a/llvm/test/Transforms/SafeStack/X86/setjmp.ll
+++ b/llvm/test/Transforms/SafeStack/X86/setjmp.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
 %struct.__sigset_t = type { [16 x i64] }
diff --git a/llvm/test/Transforms/SafeStack/X86/setjmp2.ll b/llvm/test/Transforms/SafeStack/X86/setjmp2.ll
index d5bd7c67109a161..dbb9a08dc5a190f 100644
--- a/llvm/test/Transforms/SafeStack/X86/setjmp2.ll
+++ b/llvm/test/Transforms/SafeStack/X86/setjmp2.ll
@@ -1,6 +1,8 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=I386
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s  --check-prefix=X86-64
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=I386
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s  --check-prefix=X86-64
 
 %struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
 %struct.__sigset_t = type { [16 x i64] }
diff --git a/llvm/test/Transforms/SafeStack/X86/sink-to-use.ll b/llvm/test/Transforms/SafeStack/X86/sink-to-use.ll
index 1a7984a7c04a08d..e6a95c3be82b3d4 100644
--- a/llvm/test/Transforms/SafeStack/X86/sink-to-use.ll
+++ b/llvm/test/Transforms/SafeStack/X86/sink-to-use.ll
@@ -1,6 +1,8 @@
 ; Test that unsafe alloca address calculation is done immediately before each use.
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 
 define void @f() safestack {
 entry:
diff --git a/llvm/test/Transforms/SafeStack/X86/ssp.ll b/llvm/test/Transforms/SafeStack/X86/ssp.ll
index 56e1ac69d1d7503..c40abc65ca37fbd 100644
--- a/llvm/test/Transforms/SafeStack/X86/ssp.ll
+++ b/llvm/test/Transforms/SafeStack/X86/ssp.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -safe-stack -S -mtriple=x86_64-unknown < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-unknown < %s -o - | FileCheck %s
 
 define void @foo() safestack sspreq {
 entry:
diff --git a/llvm/test/Transforms/SafeStack/X86/store.ll b/llvm/test/Transforms/SafeStack/X86/store.ll
index 6fc08760a72c761..1e737f1551d7be6 100644
--- a/llvm/test/Transforms/SafeStack/X86/store.ll
+++ b/llvm/test/Transforms/SafeStack/X86/store.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
 
diff --git a/llvm/test/Transforms/SafeStack/X86/struct.ll b/llvm/test/Transforms/SafeStack/X86/struct.ll
index 8bce24bb538080d..0c841c12025b9fd 100644
--- a/llvm/test/Transforms/SafeStack/X86/struct.ll
+++ b/llvm/test/Transforms/SafeStack/X86/struct.ll
@@ -1,5 +1,7 @@
 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
+; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
 
 %struct.foo = type { [16 x i8] }
 



More information about the llvm-commits mailing list