diff options
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/lib/xray/xray_fdr_logging.cpp | 2 | ||||
-rw-r--r-- | compiler-rt/test/profile/Linux/coverage_short_circuit.cpp | 36 |
2 files changed, 37 insertions, 1 deletions
diff --git a/compiler-rt/lib/xray/xray_fdr_logging.cpp b/compiler-rt/lib/xray/xray_fdr_logging.cpp index 7def356..977a0b9 100644 --- a/compiler-rt/lib/xray/xray_fdr_logging.cpp +++ b/compiler-rt/lib/xray/xray_fdr_logging.cpp @@ -73,7 +73,7 @@ static_assert(std::is_trivially_destructible<ThreadLocalData>::value, static pthread_key_t Key; // Global BufferQueue. -static std::byte BufferQueueStorage[sizeof(BufferQueue)]; +alignas(BufferQueue) static std::byte BufferQueueStorage[sizeof(BufferQueue)]; static BufferQueue *BQ = nullptr; // Global thresholds for function durations. diff --git a/compiler-rt/test/profile/Linux/coverage_short_circuit.cpp b/compiler-rt/test/profile/Linux/coverage_short_circuit.cpp new file mode 100644 index 0000000..54f0c4c --- /dev/null +++ b/compiler-rt/test/profile/Linux/coverage_short_circuit.cpp @@ -0,0 +1,36 @@ +// RUN: %clangxx_profgen -std=c++17 -fuse-ld=lld -fcoverage-mapping -o %t %s +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t +// RUN: llvm-profdata merge -o %t.profdata %t.profraw +// RUN: llvm-cov show %t -instr-profile=%t.profdata 2>&1 | FileCheck %s + +void foo() { // CHECK: [[@LINE]]| 1|void foo() { + bool cond1 = false; // CHECK-NEXT: [[@LINE]]| 1| bool cond1 = false; + bool cond2 = true; // CHECK-NEXT: [[@LINE]]| 1| bool cond2 = true; + if (cond1 && // CHECK-NEXT: [[@LINE]]| 1| if (cond1 && + cond2) { // CHECK-NEXT: [[@LINE]]| 0| cond2) { + } // CHECK-NEXT: [[@LINE]]| 0| } +} // CHECK-NEXT: [[@LINE]]| 1|} + +void bar() { // CHECK: [[@LINE]]| 1|void bar() { + bool cond1 = true; // CHECK-NEXT: [[@LINE]]| 1| bool cond1 = true; + bool cond2 = false; // CHECK-NEXT: [[@LINE]]| 1| bool cond2 = false; + if (cond1 && // CHECK-NEXT: [[@LINE]]| 1| if (cond1 && + cond2) { // CHECK-NEXT: [[@LINE]]| 1| cond2) { + } // CHECK-NEXT: [[@LINE]]| 0| } +} // CHECK-NEXT: [[@LINE]]| 1|} + +void baz() { // CHECK: [[@LINE]]| 1|void baz() { + bool cond1 = false; // CHECK-NEXT: [[@LINE]]| 1| bool cond1 = false; + bool cond2 = true; // CHECK-NEXT: [[@LINE]]| 1| bool cond2 = true; + if (cond1 // CHECK-NEXT: [[@LINE]]| 1| if (cond1 + && // CHECK-NEXT: [[@LINE]]| 0| && + cond2) { // CHECK-NEXT: [[@LINE]]| 0| cond2) { + } // CHECK-NEXT: [[@LINE]]| 0| } +} // CHECK-NEXT: [[@LINE]]| 1|} + +int main() { + foo(); + bar(); + baz(); + return 0; +} |