llvm.org GIT mirror llvm / 50919cc
Merging r295215: ------------------------------------------------------------------------ r295215 | arnolds | 2017-02-15 10:57:06 -0800 (Wed, 15 Feb 2017) | 11 lines ThreadSanitizer: don't track swifterror memory addresses They are register promoted by ISel and so it makes no sense to treat them as memory. Inserting calls to the thread sanitizer would also generate invalid IR. You would hit: "swifterror value can only be loaded and stored from, or as a swifterror argument!" ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_40@295376 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 3 years ago
2 changed file(s) with 31 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
487487 Value *Addr = IsWrite
488488 ? cast(I)->getPointerOperand()
489489 : cast(I)->getPointerOperand();
490
491 // swifterror memory addresses are mem2reg promoted by instruction selection.
492 // As such they cannot have regular uses like an instrumentation function and
493 // it makes no sense to track them as memory.
494 if (Addr->isSwiftError())
495 return false;
496
490497 int Idx = getMemoryAccessFuncIndex(Addr, DL);
491498 if (Idx < 0)
492499 return false;
5353 ; CHECK: ret void
5454 }
5555
56 ; CHECK-LABEL: @SwiftError
57 ; CHECK-NOT: __tsan_read
58 ; CHECK-NOT: __tsan_write
59 ; CHECK: ret
60 define void @SwiftError(i8** swifterror) sanitize_thread {
61 %swifterror_ptr_value = load i8*, i8** %0
62 store i8* null, i8** %0
63 %swifterror_addr = alloca swifterror i8*
64 %swifterror_ptr_value_2 = load i8*, i8** %swifterror_addr
65 store i8* null, i8** %swifterror_addr
66 ret void
67 }
68
69 ; CHECK-LABEL: @SwiftErrorCall
70 ; CHECK-NOT: __tsan_read
71 ; CHECK-NOT: __tsan_write
72 ; CHECK: ret
73 define void @SwiftErrorCall(i8** swifterror) sanitize_thread {
74 %swifterror_addr = alloca swifterror i8*
75 store i8* null, i8** %0
76 call void @SwiftError(i8** %0)
77 ret void
78 }
79
5680 ; CHECK: define internal void @tsan.module_ctor()
5781 ; CHECK: call void @__tsan_init()