Skip to content

Commit 3bd5172

Browse files
author
paperchalice
authored
Reland "[CodeGen] Port SafeStack to new pass manager (llvm#74027)
Forgot to update related code in `CodeGenPassBuilder.h`, also update it for `CallBrPreparePass`. Fix build when `LLVM_ENABLE_MODULES:BOOL=ON`.
1 parent 54878b8 commit 3bd5172

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+180
-4
lines changed

llvm/include/llvm/CodeGen/CodeGenPassBuilder.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
#include "llvm/Analysis/ScopedNoAliasAA.h"
2323
#include "llvm/Analysis/TargetTransformInfo.h"
2424
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
25+
#include "llvm/CodeGen/CallBrPrepare.h"
2526
#include "llvm/CodeGen/ExpandReductions.h"
2627
#include "llvm/CodeGen/MachinePassManager.h"
2728
#include "llvm/CodeGen/PreISelIntrinsicLowering.h"
2829
#include "llvm/CodeGen/ReplaceWithVeclib.h"
30+
#include "llvm/CodeGen/SafeStack.h"
2931
#include "llvm/CodeGen/UnreachableBlockElim.h"
3032
#include "llvm/IR/PassManager.h"
3133
#include "llvm/IR/Verifier.h"
@@ -715,10 +717,10 @@ template <typename Derived>
715717
void CodeGenPassBuilder<Derived>::addISelPrepare(AddIRPass &addPass) const {
716718
derived().addPreISel(addPass);
717719

718-
addPass(CallBrPrepare());
720+
addPass(CallBrPreparePass());
719721
// Add both the safe stack and the stack protection passes: each of them will
720722
// only protect functions that have corresponding attributes.
721-
addPass(SafeStackPass());
723+
addPass(SafeStackPass(&TM));
722724
addPass(StackProtectorPass());
723725

724726
if (Opt.PrintISelInput)

llvm/include/llvm/CodeGen/MachinePassRegistry.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ FUNCTION_ANALYSIS("targetir", TargetIRAnalysis, (std::move(TM.getTargetIRAnalysi
3535
#ifndef FUNCTION_PASS
3636
#define FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR)
3737
#endif
38+
FUNCTION_PASS("callbrprepare", CallBrPreparePass, ())
39+
FUNCTION_PASS("safe-stack", SafeStackPass, (TM))
3840
FUNCTION_PASS("mergeicmps", MergeICmpsPass, ())
3941
FUNCTION_PASS("lower-constant-intrinsics", LowerConstantIntrinsicsPass, ())
4042
FUNCTION_PASS("unreachableblockelim", UnreachableBlockElimPass, ())
@@ -114,7 +116,6 @@ DUMMY_FUNCTION_PASS("dwarfehprepare", DwarfEHPass, ())
114116
DUMMY_FUNCTION_PASS("winehprepare", WinEHPass, ())
115117
DUMMY_FUNCTION_PASS("wasmehprepare", WasmEHPass, ())
116118
DUMMY_FUNCTION_PASS("codegenprepare", CodeGenPreparePass, ())
117-
DUMMY_FUNCTION_PASS("safe-stack", SafeStackPass, ())
118119
DUMMY_FUNCTION_PASS("stack-protector", StackProtectorPass, ())
119120
DUMMY_FUNCTION_PASS("atomic-expand", AtomicExpandPass, ())
120121
DUMMY_FUNCTION_PASS("interleaved-access", InterleavedAccessPass, ())
@@ -123,7 +124,6 @@ DUMMY_FUNCTION_PASS("cfguard-dispatch", CFGuardDispatchPass, ())
123124
DUMMY_FUNCTION_PASS("cfguard-check", CFGuardCheckPass, ())
124125
DUMMY_FUNCTION_PASS("gc-info-printer", GCInfoPrinterPass, ())
125126
DUMMY_FUNCTION_PASS("select-optimize", SelectOptimizePass, ())
126-
DUMMY_FUNCTION_PASS("callbrprepare", CallBrPrepare, ())
127127
#undef DUMMY_FUNCTION_PASS
128128

129129
#ifndef DUMMY_MODULE_PASS

llvm/include/llvm/CodeGen/SafeStack.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//===--------------------- llvm/CodeGen/SafeStack.h -------------*- C++-*--===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_CODEGEN_SAFESTACK_H
10+
#define LLVM_CODEGEN_SAFESTACK_H
11+
12+
#include "llvm/IR/PassManager.h"
13+
14+
namespace llvm {
15+
16+
class TargetMachine;
17+
18+
class SafeStackPass : public PassInfoMixin<SafeStackPass> {
19+
const TargetMachine *TM;
20+
21+
public:
22+
explicit SafeStackPass(const TargetMachine *TM_) : TM(TM_) {}
23+
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
24+
};
25+
26+
} // namespace llvm
27+
28+
#endif // LLVM_CODEGEN_SAFESTACK_H

llvm/lib/CodeGen/SafeStack.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17+
#include "llvm/CodeGen/SafeStack.h"
1718
#include "SafeStackLayout.h"
1819
#include "llvm/ADT/APInt.h"
1920
#include "llvm/ADT/ArrayRef.h"
@@ -927,6 +928,42 @@ class SafeStackLegacyPass : public FunctionPass {
927928

928929
} // end anonymous namespace
929930

931+
PreservedAnalyses SafeStackPass::run(Function &F,
932+
FunctionAnalysisManager &FAM) {
933+
LLVM_DEBUG(dbgs() << "[SafeStack] Function: " << F.getName() << "\n");
934+
935+
if (!F.hasFnAttribute(Attribute::SafeStack)) {
936+
LLVM_DEBUG(dbgs() << "[SafeStack] safestack is not requested"
937+
" for this function\n");
938+
return PreservedAnalyses::all();
939+
}
940+
941+
if (F.isDeclaration()) {
942+
LLVM_DEBUG(dbgs() << "[SafeStack] function definition"
943+
" is not available\n");
944+
return PreservedAnalyses::all();
945+
}
946+
947+
auto *TL = TM->getSubtargetImpl(F)->getTargetLowering();
948+
if (!TL)
949+
report_fatal_error("TargetLowering instance is required");
950+
951+
auto &DL = F.getParent()->getDataLayout();
952+
953+
// preserve DominatorTree
954+
auto &DT = FAM.getResult<DominatorTreeAnalysis>(F);
955+
auto &SE = FAM.getResult<ScalarEvolutionAnalysis>(F);
956+
DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Lazy);
957+
958+
bool Changed = SafeStack(F, *TL, DL, &DTU, SE).run();
959+
960+
if (!Changed)
961+
return PreservedAnalyses::all();
962+
PreservedAnalyses PA;
963+
PA.preserve<DominatorTreeAnalysis>();
964+
return PA;
965+
}
966+
930967
char SafeStackLegacyPass::ID = 0;
931968

932969
INITIALIZE_PASS_BEGIN(SafeStackLegacyPass, DEBUG_TYPE,

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
#include "llvm/CodeGen/ExpandLargeDivRem.h"
7878
#include "llvm/CodeGen/ExpandLargeFpConvert.h"
7979
#include "llvm/CodeGen/HardwareLoops.h"
80+
#include "llvm/CodeGen/SafeStack.h"
8081
#include "llvm/CodeGen/TypePromotion.h"
8182
#include "llvm/IR/DebugInfo.h"
8283
#include "llvm/IR/Dominators.h"

llvm/lib/Passes/PassRegistry.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ FUNCTION_PASS("print<uniformity>", UniformityInfoPrinterPass(dbgs()))
390390
FUNCTION_PASS("reassociate", ReassociatePass())
391391
FUNCTION_PASS("redundant-dbg-inst-elim", RedundantDbgInstEliminationPass())
392392
FUNCTION_PASS("reg2mem", RegToMemPass())
393+
FUNCTION_PASS("safe-stack", SafeStackPass(TM))
393394
FUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass())
394395
FUNCTION_PASS("scalarizer", ScalarizerPass())
395396
FUNCTION_PASS("sccp", SCCPPass())

llvm/test/Transforms/SafeStack/AArch64/abi.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
2+
; RUN: opt -passes=safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
23

34

45
define void @foo() nounwind uwtable safestack {

llvm/test/Transforms/SafeStack/AArch64/abi_ssp.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck --check-prefixes=TLS,ANDROID %s
22
; RUN: opt -safe-stack -S -mtriple=aarch64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=TLS,FUCHSIA %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=aarch64-linux-android < %s -o - | FileCheck --check-prefixes=TLS,ANDROID %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=aarch64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=TLS,FUCHSIA %s
35

46
define void @foo() nounwind uwtable safestack sspreq {
57
entry:

llvm/test/Transforms/SafeStack/AArch64/unreachable.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -safe-stack -safe-stack-coloring -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
2+
; RUN: opt -passes=safe-stack -safe-stack-coloring -S -mtriple=aarch64-linux-android < %s -o - | FileCheck %s
23

34
define void @foo() nounwind uwtable safestack {
45
entry:

llvm/test/Transforms/SafeStack/ARM/abi.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -safe-stack -S -mtriple=arm-linux-android < %s -o - | FileCheck %s
2+
; RUN: opt -passes=safe-stack -S -mtriple=arm-linux-android < %s -o - | FileCheck %s
23

34

45
define void @foo() nounwind uwtable safestack {

llvm/test/Transforms/SafeStack/ARM/debug.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -safe-stack -safestack-use-pointer-address < %s -S | FileCheck %s
2+
; RUN: opt -passes=safe-stack -safestack-use-pointer-address < %s -S | FileCheck %s
23
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
34
target triple = "armv7-pc-linux-android"
45

llvm/test/Transforms/SafeStack/ARM/setjmp.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; Test stack pointer restore after setjmp() with the function-call safestack ABI.
22
; RUN: opt -safe-stack -S -mtriple=arm-linux-androideabi < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=arm-linux-androideabi < %s -o - | FileCheck %s
34

45
@env = global [64 x i32] zeroinitializer, align 4
56

llvm/test/Transforms/SafeStack/X86/abi.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
33
; RUN: opt -safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS32
44
; RUN: opt -safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS64
5+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
6+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
7+
; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS32
8+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck %s --check-prefix=DIRECT-TLS64
59

610

711
define void @foo() nounwind uwtable safestack {

llvm/test/Transforms/SafeStack/X86/abi_ssp.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@
88

99
; RUN: opt -safe-stack -S -mtriple=x86_64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=COMMON,FUCHSIA64 %s
1010

11+
; RUN: opt -passes=safe-stack -S -mtriple=i686-pc-linux-gnu < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
12+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefixes=COMMON,TLS64 %s
13+
14+
; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,GLOBAL32 %s
15+
; RUN: opt -passes=safe-stack -S -mtriple=i686-linux-android24 < %s -o - | FileCheck --check-prefixes=COMMON,TLS32 %s
16+
17+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-linux-android < %s -o - | FileCheck --check-prefixes=COMMON,TLS64 %s
18+
19+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-unknown-fuchsia < %s -o - | FileCheck --check-prefixes=COMMON,FUCHSIA64 %s
20+
21+
1122
define void @foo() safestack sspreq {
1223
entry:
1324
; TLS32: %[[StackGuard:.*]] = load ptr, ptr addrspace(256) inttoptr (i32 20 to ptr addrspace(256))

llvm/test/Transforms/SafeStack/X86/addr-taken.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
57

llvm/test/Transforms/SafeStack/X86/array-aligned.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
57

llvm/test/Transforms/SafeStack/X86/array.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
; array [4 x i8]
57
; Requires protector.

llvm/test/Transforms/SafeStack/X86/byval.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
57
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Transforms/SafeStack/X86/call.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
57
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Transforms/SafeStack/X86/cast.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
57

llvm/test/Transforms/SafeStack/X86/coloring-ssp.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
2+
; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
23

34
; %x and %y share a stack slot between them, but not with the stack guard.
45
define void @f() safestack sspreq {

llvm/test/Transforms/SafeStack/X86/coloring.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
define void @f() safestack {
57
entry:

llvm/test/Transforms/SafeStack/X86/coloring2.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
; x and y share the stack slot.
57
define void @f() safestack {

llvm/test/Transforms/SafeStack/X86/constant-gep-call.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
%struct.nest = type { %struct.pair, %struct.pair }
57
%struct.pair = type { i32, i32 }

llvm/test/Transforms/SafeStack/X86/constant-gep.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
%class.A = type { [2 x i8] }
57

llvm/test/Transforms/SafeStack/X86/constant-geps.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
%struct.deep = type { %union.anon }
57
%union.anon = type { %struct.anon }

llvm/test/Transforms/SafeStack/X86/debug-loc-dynamic.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
35

46
; Test llvm.dbg.value for dynamic allocas moved onto the unsafe stack.
57
; In the dynamic alloca case, the dbg.value does not change with the exception

llvm/test/Transforms/SafeStack/X86/debug-loc.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
35

46
; Test debug location for the local variables moved onto the unsafe stack.
57

llvm/test/Transforms/SafeStack/X86/debug-loc2.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - --try-experimental-debuginfo-iterators | FileCheck %s
35

46
; Test llvm.dbg.value for the local variables moved onto the unsafe stack.
57
; SafeStack rewrites them relative to the unsafe stack pointer (base address of

llvm/test/Transforms/SafeStack/X86/dynamic-alloca.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
57

llvm/test/Transforms/SafeStack/X86/escape-addr-pointer.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
57

llvm/test/Transforms/SafeStack/X86/escape-bitcast-store.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
57

llvm/test/Transforms/SafeStack/X86/escape-bitcast-store2.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
57

llvm/test/Transforms/SafeStack/X86/escape-call.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
57

llvm/test/Transforms/SafeStack/X86/escape-casted-pointer.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
57

llvm/test/Transforms/SafeStack/X86/escape-gep-call.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
%struct.pair = type { i32, i32 }
57

llvm/test/Transforms/SafeStack/X86/escape-gep-invoke.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
22
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3+
; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4+
; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
35

46
%struct.pair = type { i32, i32 }
57

0 commit comments

Comments
 (0)