banach-space wrote:

Hi @jprotze , thank you for working on this!

One thing that would be very nice to see are tests :) It would really help if 
we could see how to use and how to test this. Any chance for an end-to-end PoC 
or a demonstrator? @kiranchandramohan , would an e2e test with OpenMP enabled 
make sense to exercise this?

> Is it the right place to run the ThreadSanitizer pass?

These are uncharted waters for me, but it looks like in Clang the sanitizers 
are added [before default optimisation pipleines are 
built](https://github.com/llvm/llvm-project/blob/435ba72afda756183a1ddc7a3a160152ad630951/clang/lib/CodeGen/BackendUtil.cpp#L1006).
 I would make sure that Flang does the same or justify the rationale for any 
divergence. As far as the Flang driver is concerned, I think that you have 
correctly identified the most suitable place. I would probably extract the 
"sanitzer" logic into a dedicated hook, but that's an implementation detail for 
later.

> We see different options for an actual solution:
>    run a separate pass before the TSan pass that adds the attribute to all 
> functions while considering the blacklist

How does Clang decide when to add such attributes? Why not replicate that 
logic? Also, if you are looking for a somewhat relevant/similar pass in Flang, 
check `VScaleAttrPass`: 
https://github.com/llvm/llvm-project/blob/435ba72afda756183a1ddc7a3a160152ad630951/flang/lib/Optimizer/Transforms/VScaleAttr.cpp#L61-L79

https://github.com/llvm/llvm-project/pull/74643
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to