For pointer variables, using getSymbolAddress cannot get the coorect
address for atomic read/write operands. Use genExprAddr to fix it.
Details
Diff Detail
Event Timeline
Hi Peixin, thank you for this patch. I like the name change from numbered testcases to descriptive testcases, however can we please decouple that change from this change (as an NFC)? Right now it is hard to see the change in generated IR after this fix.
Good point. Thanks for the notice. It is truly not easy to review when I look back to this patch now :). Will decouple the change. I should also add some comments/descriptions in the test case for what kind of IR it should generate with this pathc.
As @shraiysh suggested, decouple the previous patch and add some comments in the test cases to describe what IR should be generated after this patch.
flang/test/Lower/OpenMP/atomic-write.f90 | ||
---|---|---|
49 | Shouldn't this be the following? %[[PTR_VAL:.*]] = fir.load %[[VAL_1]] : !fir.ref<!fir.ptr<i32>> omp.atomic.write %[[PTR_VAL]] = %[[VAL_3]] : !fir.ptr<i32>, i32 |
flang/test/Lower/OpenMP/atomic-write.f90 | ||
---|---|---|
49 | Right. I forgot to check tco. The previous fix fails to run tco. I had thought the codegen can handle this. Now fixed this. |
@NimishMishra this LGTM, but as you are the author of the atomic read and write lowering, please check this patch. (adding you as a blocking reviewer)
Shouldn't this be the following?