mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
92a77f4b5e
Under NPM, the asan-globals-md analysis is required but cannot be run within the asan function pass due to module analyses not being able to run from a function pass. So this pins all tests using "-asan" to the legacy PM and adds a corresponding RUN line with -passes='require<asan-globals-md>,function(asan)'. Now all tests in Instrumentation/AddressSanitizer pass when -enable-new-pm is by default on. Tests were automatically converted using the following python script and failures were manually fixed up. import sys for i in sys.argv: with open(i, 'r') as f: s = f.read() with open(i, 'w') as f: for l in s.splitlines(): if "RUN:" in l and ' -asan -asan-module ' in l and '\\' not in l: f.write(l.replace(' -asan -asan-module ', ' -asan -asan-module -enable-new-pm=0 ')) f.write('\n') f.write(l.replace(' -asan -asan-module ', " -passes='require<asan-globals-md>,function(asan),module(asan-module)' ")) f.write('\n') elif "RUN:" in l and ' -asan ' in l and '\\' not in l: f.write(l.replace(' -asan ', ' -asan -enable-new-pm=0 ')) f.write('\n') f.write(l.replace(' -asan ', " -passes='require<asan-globals-md>,function(asan)' ")) f.write('\n') else: f.write(l) f.write('\n') See https://bugs.llvm.org/show_bug.cgi?id=46611. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D83921
33 lines
1.0 KiB
LLVM
33 lines
1.0 KiB
LLVM
; Only verify that asan don't crash on global variables of different
|
|
; address space. The global variable should be unmodified by asan.
|
|
|
|
; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -S | FileCheck %s
|
|
; RUN: opt < %s -passes='asan-pipeline' -S | FileCheck %s
|
|
|
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
@a = internal addrspace(42) global [1 x i32] zeroinitializer, align 4
|
|
|
|
; CHECK: @a = internal addrspace(42) global [1 x i32] zeroinitializer, align 4
|
|
|
|
define void @b(i32 %c) {
|
|
entry:
|
|
%conv = sext i32 %c to i64
|
|
%0 = inttoptr i64 %conv to i32 addrspace(42)*
|
|
%cmp = icmp ugt i32 addrspace(42)* %0, getelementptr inbounds ([1 x i32], [1 x i32] addrspace(42)* @a, i64 0, i64 0)
|
|
br i1 %cmp, label %if.then, label %if.end
|
|
|
|
if.then:
|
|
%call = tail call i32 (...) @e()
|
|
br label %if.end
|
|
|
|
if.end:
|
|
ret void
|
|
}
|
|
|
|
declare i32 @e(...)
|
|
|
|
!llvm.asan.globals = !{!0}
|
|
!0 = !{[1 x i32] addrspace(42)* @a, null, !"a", i1 false, i1 false}
|