The pli-llvm project, a PL/I compiler with an LLVM backend, has achieved performance parity with C, reaching an average execution time ratio of 1.0 across 21 benchmarks compared to clang -O2. The compiler leverages PL/I language semantics, such as non-aliasing local variables and fixed-range numeric types, to provide the LLVM optimizer with precise data for code generation.
Developers optimized arithmetic operations by replacing runtime calls with LLVM intrinsics and ensuring fixed-point decimal arithmetic uses integer operations instead of floating-point conversions. For instance, correcting type selection in binary and decimal operations improved performance in hot loops, changing the execution time ratio from 2.3 to 0.9 at -O3 optimization levels.
Parameter passing was refined by switching internal procedures from reference-based to value-based passing for scalars. This change reduced the execution time ratio for function calls from 2.9 to approximately 1.0. Additionally, string concatenation was optimized by eliminating redundant memory allocations, reducing the RSS memory footprint from 109 MB to 1 MB at -O0.
The implementation of the index function for substring searching was improved by utilizing memchr and memcmp, and NEON instructions on ARM64. This optimization resulted in a 14-fold speedup compared to the C standard library strstr function. The project emphasizes the importance of analyzing LLVM IR to identify and eliminate inefficient runtime calls and unnecessary type conversions.




