[PATCH] D142725: [DFAJumpThreading] Enable DFAJT with LTO

Gabor Marton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 07:43:55 PST 2023


martong created this revision.
martong added reviewers: alexey.zhikhar, SjoerdMeijer, efriedma, xbolva00, amehsan.
Herald added subscribers: steakhal, luismarques, pengfei, s.egerton, gamesh411, Szelethus, PkmX, dkrupp, simoncook, rnkovacs, hiraditya, arichardson, inglorion.
Herald added a project: All.
martong requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead.
Herald added a project: LLVM.

This patch adds the DFAJumpThreading pass into the LTO default pipeline
after the peephole optimization passes. This increases the Coremark
score when LTO is used. I've measured an increase of the score with
roughly 11% on Linux-x86_64 (and we've experienced a similar growth in
case of different RISCV architectures at Codasip).

Here is the primitive Makefile I used with the latest Coremark:

  SOURCES=core_list_join.c core_main.c core_matrix.c core_state.c core_util.c posix/core_portme.c
  DEFINITIONS=-DHAS_PRINTF=1 -DHAS_STDIO=1 -DTIMES=1 -DITERATIONS=1
  
  CC=/home/gabor.marton/WORK/llvm2/build/release/bin/clang
  OBJS=$(SOURCES:%.c=build_x86_64/%.o)
  
  CFLAGS=-I./posix -I. -DCOMPILER_FLAGS=\"N/A\" \
  -O3\
  -flto\
  
  LDFLAGS=-O3\
  -flto\
  -Wl,--plugin-opt=-enable-dfa-jump-thread\
  
  build_x86_64/coremark.xexe: $(OBJS)
  	$(CC) -o $@ $(OBJS) \
  	 $(LDFLAGS)
  
  build_x86_64/%.o: %.c
  	mkdir -p build_x86_64
  	mkdir -p build_x86_64/posix
  	$(CC) -c -o $@ $< $(CFLAGS) $(DEFINITIONS)

Co-author: Martin Ministr (Codasip.com)
Co-author: Pavel Snobl (Codasip.com)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142725

Files:
  llvm/lib/Passes/PassBuilderPipelines.cpp


Index: llvm/lib/Passes/PassBuilderPipelines.cpp
===================================================================
--- llvm/lib/Passes/PassBuilderPipelines.cpp
+++ llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1729,6 +1729,8 @@
   // The IPO Passes may leave cruft around. Clean up after them.
   FPM.addPass(InstCombinePass());
   invokePeepholeEPCallbacks(FPM, Level);
+  if (EnableDFAJumpThreading && Level.getSizeLevel() == 0)
+    FPM.addPass(DFAJumpThreadingPass());
 
   if (EnableConstraintElimination)
     FPM.addPass(ConstraintEliminationPass());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142725.492756.patch
Type: text/x-patch
Size: 558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230127/4c78a8de/attachment.bin>


More information about the llvm-commits mailing list