Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BoundsSafety] Fix for opt-remarks #9771

Open
wants to merge 1 commit into
base: stable/20240723
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// XFAIL: *


// RUN: %clang_cc1 -fbounds-safety -Os %s -triple arm64-apple-iphoneos -emit-llvm -o %t-Os.s -opt-record-file %t-Os.opt.yaml -opt-record-format yaml
// RUN: FileCheck --input-file %t-Os.opt.yaml --check-prefixes OPT-REM %s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// XFAIL: *


// RUN: %clang_cc1 -fbounds-safety -Os %s -triple arm64-apple-iphoneos -emit-llvm -o %t-Os.s -opt-record-file %t-Os.opt.yaml -opt-record-format yaml
// RUN: FileCheck --input-file %t-Os.opt.yaml --check-prefixes OPT-REM %s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// XFAIL: *


// RUN: %clang_cc1 -triple x86_64-apple-macos -Wno-bounds-safety-init-list -fbounds-safety -O0 %s -emit-llvm -o %t-O0.s -opt-record-file %t-O0.opt.yaml -opt-record-format yaml
// RUN: FileCheck --input-file %t-O0.s --check-prefixes IR %s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char **argv) {
// OPT-REM-NEXT: Pass: annotation-remarks
// OPT-REM-NEXT: Name: BoundsSafetyCheck
// OPT-REM-NEXT: DebugLoc: { File: '{{.*}}bounds-safety-ptr-conversion-O2.c',
// OPT-REM-NEXT: Line: 0, Column: 0 }
// OPT-REM-NEXT: Line: 12, Column: 25 }
// OPT-REM-NEXT: Function: main
// OPT-REM-NEXT: Args:
// OPT-REM-NEXT: - String: 'Inserted '
Expand All @@ -115,20 +115,20 @@ int main(int argc, char **argv) {
// OPT-REM-NEXT: - String: s
// OPT-REM-NEXT: - String: "\n"
// OPT-REM-NEXT: - String: "used for:\n"
// OPT-REM-NEXT: - String: bounds-safety-generic, bounds-safety-check-ptr-lt-upper-bound, bounds-safety-check-ptr-ge-lower-bound
// OPT-REM-NEXT: - String: bounds-safety-check-ptr-neq-null
// OPT-REM-NEXT: - String: |
// OPT-REM-NEXT: {{^[ ]+$}}
// OPT-REM-NEXT: {{^[ ]+$}}
// OPT-REM-NEXT: instructions:
// OPT-REM-EMPTY:
// OPT-REM-NEXT: - String: "trap (LLVM IR 'call')\nother (LLVM IR 'unreachable')"
// OPT-REM-NEXT: - String: "cmp eq (LLVM IR 'icmp')\ncond branch (LLVM IR 'br')"
// OPT-REM-NEXT: ...

// OPT-REM-NEXT: --- !Analysis
// OPT-REM-NEXT: Pass: annotation-remarks
// OPT-REM-NEXT: Name: BoundsSafetyCheck
// OPT-REM-NEXT: DebugLoc: { File: '{{.*}}bounds-safety-ptr-conversion-O2.c',
// OPT-REM-NEXT: Line: 12, Column: 25 }
// OPT-REM-NEXT: Line: 0, Column: 0 }
// OPT-REM-NEXT: Function: main
// OPT-REM-NEXT: Args:
// OPT-REM-NEXT: - String: 'Inserted '
Expand All @@ -137,13 +137,13 @@ int main(int argc, char **argv) {
// OPT-REM-NEXT: - String: s
// OPT-REM-NEXT: - String: "\n"
// OPT-REM-NEXT: - String: "used for:\n"
// OPT-REM-NEXT: - String: bounds-safety-check-ptr-neq-null
// OPT-REM-NEXT: - String: bounds-safety-generic, bounds-safety-check-ptr-lt-upper-bound, bounds-safety-check-ptr-ge-lower-bound
// OPT-REM-NEXT: - String: |
// OPT-REM-NEXT: {{^[ ]+$}}
// OPT-REM-NEXT: {{^[ ]+$}}
// OPT-REM-NEXT: instructions:
// OPT-REM-EMPTY:
// OPT-REM-NEXT: - String: "cmp eq (LLVM IR 'icmp')\ncond branch (LLVM IR 'br')"
// OPT-REM-NEXT: - String: "trap (LLVM IR 'call')\nother (LLVM IR 'unreachable')"
// OPT-REM-NEXT: ...

// OPT-REM-NOT: --- !Analysis
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// XFAIL: *


// RUN: %clang_cc1 -fbounds-safety -O0 %s -emit-llvm -o %t-O0.s -opt-record-file %t-O0.opt.yaml -opt-record-format yaml
// RUN: FileCheck --input-file %t-O0.s --check-prefixes IR %s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// XFAIL: *


// RUN: %clang_cc1 -fbounds-safety -O0 %s -emit-llvm -o %t-O0.s -opt-record-file %t-O0.opt.yaml -opt-record-format yaml
// RUN: FileCheck --input-file %t-O0.s --check-prefixes IR %s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// XFAIL: *


// RUN: %clang_cc1 -triple x86_64-apple-macos -fbounds-safety -O0 %s -emit-llvm -o %t-O0.s -opt-record-file %t-O0.opt.yaml -opt-record-format yaml
// RUN: FileCheck --input-file %t-O0.s --check-prefixes IR %s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// XFAIL: *


// RUN: %clang_cc1 -triple x86_64-apple-macos -fbounds-safety -O0 %s -emit-llvm -o %t-O0.s -opt-record-file %t-O0.opt.yaml -opt-record-format yaml
// RUN: FileCheck --input-file %t-O0.s --check-prefixes IR %s
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static void runImpl(Function &F, const TargetLibraryInfo &TLI) {
return;

// Track all annotated instructions aggregated based on their debug location.
DenseMap<MDNode *, SmallVector<Instruction *, 4>> DebugLoc2Annotated;
MapVector<MDNode *, SmallVector<Instruction *, 4>> DebugLoc2Annotated;

OptimizationRemarkEmitter ORE(&F);
// First, generate a summary of the annotated instructions.
Expand Down