[compiler-rt] r286136 - [tsan] Cast floating-point types correctly when instrumenting atomic accesses, compiler-rt part

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 7 11:10:13 PST 2016


Author: kuba.brecka
Date: Mon Nov  7 13:10:13 2016
New Revision: 286136

URL: http://llvm.org/viewvc/llvm-project?rev=286136&view=rev
Log:
[tsan] Cast floating-point types correctly when instrumenting atomic accesses, compiler-rt part

Although rare, atomic accesses to floating-point types seem to be valid, i.e. `%a = load atomic float ...`. The TSan instrumentation pass however tries to emit inttoptr, which is incorrect, we should use a bitcast here. Anyway, IRBuilder already has a convenient helper function for this.

Differential Revision: https://reviews.llvm.org/D26266


Added:
    compiler-rt/trunk/test/tsan/Darwin/objc-double-property.mm

Added: compiler-rt/trunk/test/tsan/Darwin/objc-double-property.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/objc-double-property.mm?rev=286136&view=auto
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/objc-double-property.mm (added)
+++ compiler-rt/trunk/test/tsan/Darwin/objc-double-property.mm Mon Nov  7 13:10:13 2016
@@ -0,0 +1,21 @@
+// RUN: %clangxx_tsan -O0 %s -o %t -framework Foundation && %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s -o %t -framework Foundation && %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O2 %s -o %t -framework Foundation && %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O3 %s -o %t -framework Foundation && %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s
+
+#import <Foundation/Foundation.h>
+
+ at interface MyClass : NSObject
+ at property float a;
+ at property double b;
+ at property long double c;
+ at end
+
+ at implementation MyClass
+ at end
+
+int main() {
+  NSLog(@"Hello world");
+}
+
+// CHECK: Hello world




More information about the llvm-commits mailing list