Verifying Optimizations of Concurrent Programs in the Promising Semantics


Weak memory models for concurrent programming languages are expected to admit standard compiler optimizations. However, prior works on verifying optimizations in weak memory models are mostly focused on simple optimizations on small code snippets which satisfy certain syntactic requirements. It receives less attention whether weak memory models can admit real-world optimization algorithms based on program analyses.

In this paper, we develop the first simulation technique for verifying thread-local analyses-based optimizations in the promising semantics PS2.1, which is a weak memory model recently proposed for C/C++11 concurrency. Our simulation is based on a novel non-preemptive semantics, which is equivalent to the original PS2.1 but has less non-determinism. We apply our simulation to verify four optimizations in PS2.1: constant propagation, dead code elimination, common subexpression elimination and loop invariant code motion.


Junpeng Zha
Hongjin Liang
Xinyu Feng


In Proc. 43rd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'22), San Diego, CA, USA, pages 903-917, June 2022.