[llvm-bugs] [Bug 45635] New: InstCombine propagates values across omp barrier, after D75010
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Apr 21 23:55:15 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45635
Bug ID: 45635
Summary: InstCombine propagates values across omp barrier,
after D75010
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Clang Compiler Support
Assignee: unassignedclangbugs at nondot.org
Reporter: chang-sun.lin.jr at intel.com
CC: llvm-bugs at lists.llvm.org
Created attachment 23394
--> https://bugs.llvm.org/attachment.cgi?id=23394&action=edit
test case
The attached test started giving different results @ O2, after commit
D75010/rG72b51d6f93b5. It has a code sequence like this:
#pragma omp critical
shared_var++;
#pragma omp barrier
printf("expecting 2: %d\n", shared_var);
D75010 marks the kmpc_barrier function with inaccessiblemem_or_argmemonly,
which allows InstCombine to propagate the local thread's shared_var value
across the barrier, to the printf. The different threads print different values
of shared_var. The standard seems to say that barrier implies a flush of the
data visible to the thread, ensuring that all threads see the same view of
memory after the barrier.
Compiled with:
clang -fopenmp -O2 barrier.c
Expecting this output:
expecting 2: 2
expecting 2: 2
Got this output:
expecting 2: 2
expecting 2: 1
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200422/e948f284/attachment.html>
More information about the llvm-bugs
mailing list