Page MenuHomePhabricator

[Passes] Add extra LoopSimplifyCFG run after IndVarSimplify (WIP).
Needs ReviewPublic

Authored by fhahn on Apr 19 2021, 11:38 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

IndVarSimplify may simplify branch conditions for blocks in loops, but
does not simplify conditional to unconditional branches.

This can pessimize later passes, like loop-delete, which check for
certain conditions across all blocks in a loop. This results in cases
where we fail to delete or vectorize loops, e.g. because they contain
dynamically dead blocks with calls with side effects.

See PR28969.

Compile-time impact:

  • O3 geomean: +0.10%
  • O3 ThinLTO: +0.16%
  • O3 LTO : +0.21%

http://llvm-compile-time-tracker.com/compare.php?from=ddcdeae358685f941c3520e01b0a8e86e3aca04b&to=15bf70b47626fa7baf2c671fe8753bee178f98cf&stat=instructions

This shakes up quite a few things, with quite a few stats changes across
MultiSource/SPEC2000/SPEC2006 on X86 with -flto -O3

e.g.

Same hash: 203 (filtered out)
Remaining: 34
Metric: loop-vectorize.LoopsVectorized

Program                                        base   patch  diff
 test-suite...6/464.h264ref/464.h264ref.test   156.00 159.00  1.9%
 test-suite...marks/7zip/7zip-benchmark.test   336.00 341.00  1.5%
 test-suite...T2006/445.gobmk/445.gobmk.test    90.00  90.00  0.0%
 test-suite...ProxyApps-C++/CLAMR/CLAMR.test   196.00 196.00  0.0%

 Same hash: 203 (filtered out)
Remaining: 34
Metric: scalar-evolution.NumTripCountsComputed

Program                                        base     patch    diff
 test-suite...nch/fourinarow/fourinarow.test    64.00    81.00   26.6%
 test-suite...6/464.h264ref/464.h264ref.test   5330.00  5969.00  12.0%
 test-suite...cations/hexxagon/hexxagon.test    77.00    84.00    9.1%
 test-suite...ications/JM/lencod/lencod.test   5227.00  5660.00   8.3%
 test-suite...ications/JM/ldecod/ldecod.test   2396.00  2592.00   8.2%
 test-suite.../Prolangs-C/loader/loader.test    13.00    14.00    7.7%
 test-suite...nal/skidmarks10/skidmarks.test   933.00   993.00    6.4%
 test-suite...lications/viterbi/viterbi.test    49.00    52.00    6.1%
 test-suite...nsumer-lame/consumer-lame.test   1715.00  1779.00   3.7%
 test-suite...T2006/445.gobmk/445.gobmk.test   2611.00  2687.00   2.9%
 test-suite...marks/7zip/7zip-benchmark.test   4512.00  4642.00   2.9%
 test-suite...CI_Purple/SMG2000/smg2000.test   2007.00  2057.00   2.5%
 test-suite...CFP2000/188.ammp/188.ammp.test   741.00   759.00    2.4%
 test-suite...006/453.povray/453.povray.test   2504.00  2560.00   2.2%
 test-suite...:: External/Povray/povray.test   2583.00  2633.00   1.9%
 test-suite.../CINT2000/176.gcc/176.gcc.test   2602.00  2650.00   1.8%
 test-suite...abench/jpeg/jpeg-6a/cjpeg.test   1307.00  1326.00   1.5%
 test-suite...nsumer-jpeg/consumer-jpeg.test   1332.00  1351.00   1.4%
 test-suite...TimberWolfMC/timberwolfmc.test   1283.00  1299.00   1.2%
 test-suite...006/447.dealII/447.dealII.test   22333.00 22579.00  1.1%
 test-suite...T2006/456.hmmer/456.hmmer.test   1671.00  1688.00   1.0%
 test-suite...ternal/HMMER/hmmcalibrate.test   1672.00  1689.00   1.0%
 test-suite...peg2/mpeg2dec/mpeg2decode.test   497.00   502.00    1.0%

Diff Detail

Unit TestsFailed

TimeTest
60 msx64 debian > LLVM.Other::new-pm-defaults.ll
Script: -- : 'RUN: at line 10'; /mnt/disks/ssd0/agent/llvm-project/build/bin/opt -disable-verify -verify-cfg-preserved=1 -debug-pass-manager -passes='default<O1>' -S /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-defaults.ll 2>&1 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-defaults.ll --check-prefixes=CHECK-O,CHECK-DEFAULT,CHECK-O1,CHECK-NOEXT
60 msx64 debian > LLVM.Other::new-pm-lto-defaults.ll
Script: -- : 'RUN: at line 5'; /mnt/disks/ssd0/agent/llvm-project/build/bin/opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -passes='lto<O1>' -S /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-lto-defaults.ll 2>&1 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-lto-defaults.ll --check-prefix=CHECK-O --check-prefix=CHECK-O1
70 msx64 debian > LLVM.Other::new-pm-thinlto-defaults.ll
Script: -- : 'RUN: at line 11'; /mnt/disks/ssd0/agent/llvm-project/build/bin/opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -passes='thinlto-pre-link<O1>' -S /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-thinlto-defaults.ll 2>&1 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-thinlto-defaults.ll --check-prefixes=CHECK-O,CHECK-O1,CHECK-PRELINK-O,CHECK-PRELINK-O-NODIS
40 msx64 debian > LLVM.Other::new-pm-thinlto-postlink-pgo-defaults.ll
Script: -- : 'RUN: at line 4'; /mnt/disks/ssd0/agent/llvm-project/build/bin/opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -passes='thinlto<O1>' -S /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll 2>&1 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll --check-prefixes=CHECK-O,CHECK-O1,CHECK-NOEXT
50 msx64 debian > LLVM.Other::new-pm-thinlto-postlink-samplepgo-defaults.ll
Script: -- : 'RUN: at line 3'; /mnt/disks/ssd0/agent/llvm-project/build/bin/opt -disable-verify -verify-cfg-preserved=0 -debug-pass-manager -pgo-kind=pgo-sample-use-pipeline -profile-file='/mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/Inputs/new-pm-thinlto-samplepgo-defaults.prof' -passes='thinlto<O1>' -S /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll 2>&1 | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll --check-prefixes=CHECK-O,CHECK-O1,CHECK-NOEXT
View Full Test Results (14 Failed)

Event Timeline

fhahn created this revision.Apr 19 2021, 11:38 AM
fhahn requested review of this revision.Apr 19 2021, 11:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2021, 11:38 AM