[PATCH] D143129: [GVN] Do not propagate equalities for noalias pointers
Usman Nadeem via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 19:15:38 PST 2023
mnadeem added a comment.
@nikic
I was looking at https://llvm.org/devmtg/2018-04/slides/Lopes-Sbirlea-Pointers,%20Alias%20and%20ModRef%20Analyses.pdf page 15, which says that replacement with null ptr is safe. So I did two runs, one where we do pointer replacement only when they have same underlying objects, and the another where we also replace pointers with null.
Here are the diffs for llvm-test-suite bitcode:
https://github.com/UsmanNadeem/vigilant-octo-journey/commit/125698f591df1f8de81ad4119b0838e135a18af8
and
https://github.com/UsmanNadeem/vigilant-octo-journey/commit/a778479334852e7f05b5a248da4473106aa986fb
here is some data:
Tests: 2432
Metric: gvn.NumGVNInstr
Program gvn.NumGVNInstr
base sameunderlying-and-nullptr sameunderlying diff
MultiSource/Benchmarks/Olden/tsp/tsp 35.00 21.00 21.00 66.7%
MultiSourc...s/Prolangs-C++/objects/objects 16.00 16.00 14.00 14.3%
MultiSourc...nchmarks/tramp3d-v4/tramp3d-v4 7857.00 6964.00 6936.00 13.3%
MultiSource/Benchmarks/McCat/09-vor/vor 59.00 55.00 54.00 9.3%
MicroBench...CALS/SubsetBRawLoops/lcalsBRaw 1267.00 1363.00 1324.00 7.6%
MicroBench...ubsetBLambdaLoops/lcalsBLambda 1270.00 1366.00 1327.00 7.6%
MicroBench...ubsetALambdaLoops/lcalsALambda 1350.00 1446.00 1407.00 7.1%
MicroBench...CALS/SubsetARawLoops/lcalsARaw 1321.00 1414.00 1375.00 7.0%
MicroBench...ubsetCLambdaLoops/lcalsCLambda 1370.00 1466.00 1427.00 7.0%
MicroBench...CALS/SubsetCRawLoops/lcalsCRaw 1393.00 1489.00 1450.00 6.9%
MicroBench...teralFiltering/BilateralFilter 69.00 72.00 72.00 4.3%
MultiSourc.../DOE-ProxyApps-C++/CLAMR/CLAMR 6769.00 7044.00 7038.00 4.1%
MicroBench.../ImageProcessing/Dither/Dither 75.00 78.00 78.00 4.0%
MultiSourc...ks/FreeBench/analyzer/analyzer 29.00 29.00 30.00 3.4%
SingleSour...ks/Misc-C++/stepanov_container 577.00 558.00 558.00 3.4%
Geomean difference 0.5%
gvn.NumGVNInstr
run base sameunderlying-and-nullptr sameunderlying diff
count 334.000000 334.000000 334.000000 334.000000
mean 376.790419 376.655689 375.895210 0.005643
std 1264.258518 1254.702622 1253.774169 0.039618
min 1.000000 1.000000 1.000000 0.000000
25% 9.000000 9.000000 9.000000 0.000000
50% 29.000000 29.000000 29.000000 0.000000
75% 125.000000 125.000000 125.000000 0.000000
max 10671.000000 10671.000000 10671.000000 0.666667
Tests: 2432
Metric: gvn.NumGVNLoad
Program gvn.NumGVNLoad
base sameunderlying-and-nullptr sameunderlying diff
ultiSource/Applications/SPASS/SPASS 398.00 394.00 394.00 1.0%
ultiSource/Applications/kimwitu++/kc 204.00 202.00 202.00 1.0%
ultiSource...-ProxyApps-C++/PENNANT/PENNANT 149.00 150.00 150.00 0.7%
icroBenchm...ubsetBLambdaLoops/lcalsBLambda 207.00 207.00 208.00 0.5%
icroBenchm...CALS/SubsetBRawLoops/lcalsBRaw 209.00 209.00 210.00 0.5%
icroBenchm...CALS/SubsetARawLoops/lcalsARaw 226.00 226.00 227.00 0.4%
icroBenchm...ubsetALambdaLoops/lcalsALambda 230.00 230.00 231.00 0.4%
icroBenchm...ubsetCLambdaLoops/lcalsCLambda 231.00 231.00 232.00 0.4%
icroBenchm...CALS/SubsetCRawLoops/lcalsCRaw 244.00 244.00 245.00 0.4%
ultiSource.../Applications/JM/ldecod/ldecod 646.00 645.00 645.00 0.2%
ultiSource.../DOE-ProxyApps-C++/CLAMR/CLAMR 934.00 933.00 933.00 0.1%
ultiSource...nchmarks/tramp3d-v4/tramp3d-v4 978.00 977.00 977.00 0.1%
ultiSource...ring-flt/LoopRestructuring-flt 1.00 1.00 1.00 0.0%
ultiSource...ring-dbl/LoopRestructuring-dbl 1.00 1.00 1.00 0.0%
ultiSource...marks/Trimaran/enc-pc1/enc-pc1 2.00 2.00 2.00 0.0%
Geomean difference 0.0%
gvn.NumGVNLoad
run base sameunderlying-and-nullptr sameunderlying diff
count 216.000000 216.000000 216.000000 216.000000
mean 92.689815 92.652778 92.680556 0.000265
std 283.845653 283.785744 283.798757 0.001286
min 1.000000 1.000000 1.000000 0.000000
25% 2.000000 2.000000 2.000000 0.000000
50% 10.000000 10.000000 10.000000 0.000000
75% 44.000000 44.000000 44.000000 0.000000
max 2516.000000 2516.000000 2516.000000 0.010152
Tests: 2432
Metric: gvn.NumGVNPRE
Program gvn.NumGVNPRE
base sameunderlying-and-nullptr sameunderlying diff
SingleSour.../Benchmarks/Misc-C++-EH/spirit 5.00 2.00 2.00 150.0%
SingleSour...ks/Misc-C++/stepanov_container 22.00 19.00 19.00 15.8%
MultiSourc...-ProxyApps-C++/PENNANT/PENNANT 12.00 11.00 11.00 9.1%
MultiSourc...e/Applications/ClamAV/clamscan 109.00 107.00 107.00 1.9%
MultiSourc.../DOE-ProxyApps-C++/CLAMR/CLAMR 377.00 372.00 372.00 1.3%
Bitcode/Be...hmarks/Halide/blur/halide_blur 4.00 4.00 4.00 0.0%
MultiSourc...s/Prolangs-C++/objects/objects 1.00 1.00 1.00 0.0%
MultiSourc...olangs-C/unix-smail/unix-smail 8.00 8.00 8.00 0.0%
MultiSourc...s/Prolangs-C/football/football 6.00 6.00 6.00 0.0%
MultiSourc...s/Prolangs-C/compiler/compiler 2.00 2.00 2.00 0.0%
MultiSourc...marks/Prolangs-C/bison/mybison 19.00 19.00 19.00 0.0%
MultiSourc...Prolangs-C/assembler/assembler 1.00 1.00 1.00 0.0%
MultiSourc...rolangs-C/archie-client/archie 2.00 2.00 2.00 0.0%
MultiSourc...chmarks/Prolangs-C/agrep/agrep 17.00 17.00 17.00 0.0%
MultiSourc...gs-C/TimberWolfMC/timberwolfmc 49.00 49.00 49.00 0.0%
Geomean difference 1.1%
gvn.NumGVNPRE
run base sameunderlying-and-nullptr sameunderlying diff
count 111.000000 110.000000 110.000000 111.000000
mean 20.684685 20.654545 20.654545 0.016044
std 46.993226 46.829857 46.829857 0.143183
min 1.000000 1.000000 1.000000 0.000000
25% 2.000000 2.000000 2.000000 0.000000
50% 5.000000 5.000000 5.000000 0.000000
75% 16.000000 16.500000 16.500000 0.000000
max 377.000000 372.000000 372.000000 1.500000
Tests: 2432
Metric: gvn.NumGVNBlocks
Program gvn.NumGVNBlocks
base sameunderlying-and-nullptr sameunderlying diff
MultiSourc...OE-ProxyApps-C++/miniFE/miniFE 69.00 68.00 68.00 1.5%
MultiSourc...enchmarks/mafft/pairlocalalign 578.00 578.00 578.00 0.0%
SingleSour...enchmarks/BenchmarkGame/n-body 15.00 15.00 15.00 0.0%
SingleSour...chmarks/BenchmarkGame/fannkuch 14.00 14.00 14.00 0.0%
SingleSour...arks/BenchmarkGame/Large/fasta 2.00 2.00 2.00 0.0%
SingleSour...arks/Adobe-C++/stepanov_vector 4.00 4.00 4.00 0.0%
SingleSour...Adobe-C++/stepanov_abstraction 4.00 4.00 4.00 0.0%
SingleSour...++/simple_types_loop_invariant 2.00 2.00 2.00 0.0%
SingleSour.../simple_types_constant_folding 126.00 126.00 126.00 0.0%
SingleSour...nchmarks/Adobe-C++/loop_unroll 8.00 8.00 8.00 0.0%
SingleSour...arks/Adobe-C++/functionobjects 3.00 3.00 3.00 0.0%
MultiSourc...++11/frame_layout/frame_layout 2.00 2.00 2.00 0.0%
MultiSourc...nchmarks/tramp3d-v4/tramp3d-v4 503.00 503.00 503.00 0.0%
MultiSource/Benchmarks/nbench/nbench 48.00 48.00 48.00 0.0%
MultiSourc...nch/mpeg2/mpeg2dec/mpeg2decode 53.00 53.00 53.00 0.0%
Geomean difference 0.0%
gvn.NumGVNBlocks
run base sameunderlying-and-nullptr sameunderlying diff
count 291.000000 291.000000 291.000000 291.000000
mean 47.079038 47.075601 47.075601 0.000051
std 130.828991 130.828426 130.828426 0.000862
min 1.000000 1.000000 1.000000 0.000000
25% 2.000000 2.000000 2.000000 0.000000
50% 8.000000 8.000000 8.000000 0.000000
75% 50.000000 50.000000 50.000000 0.000000
max 1476.000000 1476.000000 1476.000000 0.014706
Tests: 2432
Metric: gvn.NumGVNSimpl
Program gvn.NumGVNSimpl
base sameunderlying-and-nullptr sameunderlying diff
MultiSourc...s/Prolangs-C++/objects/objects 4.00 4.00 2.00 100.0%
MultiSourc...nchmarks/tramp3d-v4/tramp3d-v4 3739.00 3002.00 2984.00 25.3%
MicroBench.../ImageProcessing/Dither/Dither 34.00 39.00 39.00 14.7%
MicroBench...ubsetBLambdaLoops/lcalsBLambda 415.00 474.00 434.00 14.2%
MicroBench...CALS/SubsetBRawLoops/lcalsBRaw 415.00 474.00 434.00 14.2%
MicroBench...CALS/SubsetCRawLoops/lcalsCRaw 421.00 480.00 440.00 14.0%
MicroBench...ubsetCLambdaLoops/lcalsCLambda 426.00 485.00 445.00 13.8%
MicroBench...ubsetALambdaLoops/lcalsALambda 430.00 489.00 449.00 13.7%
MicroBench...CALS/SubsetARawLoops/lcalsARaw 412.00 468.00 428.00 13.6%
MicroBench...teralFiltering/BilateralFilter 38.00 43.00 43.00 13.2%
MultiSource/Applications/kimwitu++/kc 702.00 786.00 786.00 12.0%
MultiSourc.../DOE-ProxyApps-C++/CLAMR/CLAMR 2460.00 2740.00 2734.00 11.4%
SingleSource/Benchmarks/Misc-C++/bigfib 53.00 59.00 59.00 11.3%
MultiSource/Benchmarks/McCat/09-vor/vor 10.00 10.00 9.00 11.1%
MultiSourc...ks/FreeBench/analyzer/analyzer 15.00 15.00 16.00 6.7%
Geomean difference 0.9%
gvn.NumGVNSimpl
run base sameunderlying-and-nullptr sameunderlying diff
count 311.000000 311.000000 311.000000 311.000000
mean 155.244373 155.379421 154.565916 0.010764
std 511.943543 502.146410 501.382767 0.063660
min 1.000000 1.000000 1.000000 0.000000
25% 6.000000 6.000000 6.000000 0.000000
50% 17.000000 17.000000 17.000000 0.000000
75% 59.000000 60.500000 60.500000 0.000000
max 4872.000000 4871.000000 4871.000000 1.000000
Tests: 2432
Metric: gvn.NumGVNEqProp
Program gvn.NumGVNEqProp
base sameunderlying-and-nullptr sameunderlying diff
MultiSourc...OE-ProxyApps-C++/miniFE/miniFE 66.00 8.00 4.00 1550.0%
SingleSour.../Benchmarks/Misc-C++-EH/spirit 49.00 3.00 3.00 1533.3%
SingleSour...ks/Misc-C++/stepanov_container 107.00 12.00 11.00 872.7%
SingleSource/Benchmarks/Misc-C++/bigfib 18.00 2.00 2.00 800.0%
MultiSourc.../DOE-ProxyApps-C++/HPCCG/HPCCG 6.00 1.00 1.00 500.0%
MultiSourc.../Benchmarks/McCat/15-trie/trie 6.00 6.00 1.00 500.0%
MultiSourc...hmarks/MallocBench/cfrac/cfrac 6.00 6.00 1.00 500.0%
MultiSourc.../DOE-ProxyApps-C++/CLAMR/CLAMR 874.00 175.00 169.00 417.2%
MultiSourc...nchmarks/tramp3d-v4/tramp3d-v4 222.00 75.00 43.00 416.3%
MultiSource/Benchmarks/McCat/09-vor/vor 14.00 3.00 366.7%
MultiSource/Applications/kimwitu++/kc 293.00 72.00 63.00 365.1%
MultiSourc...-ProxyApps-C++/PENNANT/PENNANT 55.00 12.00 12.00 358.3%
MicroBench...ubsetCLambdaLoops/lcalsCLambda 122.00 70.00 37.00 229.7%
MicroBench...ubsetBLambdaLoops/lcalsBLambda 122.00 70.00 37.00 229.7%
MicroBench...CALS/SubsetBRawLoops/lcalsBRaw 122.00 70.00 37.00 229.7%
Geomean difference 37.7%
gvn.NumGVNEqProp
run base sameunderlying-and-nullptr sameunderlying diff
count 147.000000 133.000000 126.000000 147.000000
mean 44.442177 33.511278 30.103175 0.809993
std 104.076048 69.462614 60.728356 2.227728
min 1.000000 1.000000 1.000000 0.000000
25% 2.000000 2.000000 2.000000 0.000000
50% 9.000000 9.000000 8.000000 0.000000
75% 36.500000 34.000000 34.000000 0.431444
max 874.000000 509.000000 373.000000 15.500000
Tests: 2432
Metric: gvn.NumPRELoad
Program gvn.NumPRELoad
base sameunderlying-and-nullptr sameunderlying diff
ultiSource/Benchmarks/Olden/tsp/tsp 11.00 7.00 7.00 57.1%
ultiSource/Benchmarks/McCat/09-vor/vor 10.00 8.00 8.00 25.0%
ultiSource...nchmarks/tramp3d-v4/tramp3d-v4 1133.00 1061.00 1061.00 6.8%
ultiSource/Applications/d/make_dparser 191.00 192.00 192.00 0.5%
ultiSource...sumer-typeset/consumer-typeset 727.00 726.00 726.00 0.1%
ultiSource...VC/Expansion-dbl/Expansion-dbl 6.00 6.00 6.00 0.0%
ultiSource/Benchmarks/Ptrdist/ft/ft 3.00 3.00 3.00 0.0%
ultiSource/Benchmarks/Ptrdist/ks/ks 3.00 3.00 3.00 0.0%
ultiSource...Benchmarks/Ptrdist/yacr2/yacr2 35.00 35.00 35.00 0.0%
ultiSource...Benchmarks/SciMark2-C/scimark2 11.00 11.00 11.00 0.0%
ultiSource...ontrolFlow-dbl/ControlFlow-dbl 7.00 7.00 7.00 0.0%
ultiSource...ontrolFlow-flt/ControlFlow-flt 7.00 7.00 7.00 0.0%
ultiSource...lds-dbl/CrossingThresholds-dbl 1.00 1.00 1.00 0.0%
ultiSource...lds-flt/CrossingThresholds-flt 1.00 1.00 1.00 0.0%
icroBenchmarks/Builtins/Int128/Builtins 12.00 12.00 12.00 0.0%
Geomean difference 0.4%
gvn.NumPRELoad
run base sameunderlying-and-nullptr sameunderlying diff
count 194.000000 194.000000 194.000000 194.000000
mean 74.097938 73.695876 73.695876 0.004618
std 186.856476 184.798491 184.798491 0.044925
min 1.000000 1.000000 1.000000 0.000000
25% 2.000000 2.000000 2.000000 0.000000
50% 7.500000 7.000000 7.000000 0.000000
75% 42.000000 42.000000 42.000000 0.000000
max 1133.000000 1061.000000 1061.000000 0.571429
Tests: 2432
Metric: gvn.NumPRELoad
Program gvn.NumPRELoad
base sameunderlying-and-nullptr sameunderlying diff
ultiSource/Benchmarks/Olden/tsp/tsp 11.00 7.00 7.00 57.1%
ultiSource/Benchmarks/McCat/09-vor/vor 10.00 8.00 8.00 25.0%
ultiSource...nchmarks/tramp3d-v4/tramp3d-v4 1133.00 1061.00 1061.00 6.8%
ultiSource/Applications/d/make_dparser 191.00 192.00 192.00 0.5%
ultiSource...sumer-typeset/consumer-typeset 727.00 726.00 726.00 0.1%
ultiSource...VC/Expansion-dbl/Expansion-dbl 6.00 6.00 6.00 0.0%
ultiSource/Benchmarks/Ptrdist/ft/ft 3.00 3.00 3.00 0.0%
ultiSource/Benchmarks/Ptrdist/ks/ks 3.00 3.00 3.00 0.0%
ultiSource...Benchmarks/Ptrdist/yacr2/yacr2 35.00 35.00 35.00 0.0%
ultiSource...Benchmarks/SciMark2-C/scimark2 11.00 11.00 11.00 0.0%
ultiSource...ontrolFlow-dbl/ControlFlow-dbl 7.00 7.00 7.00 0.0%
ultiSource...ontrolFlow-flt/ControlFlow-flt 7.00 7.00 7.00 0.0%
ultiSource...lds-dbl/CrossingThresholds-dbl 1.00 1.00 1.00 0.0%
ultiSource...lds-flt/CrossingThresholds-flt 1.00 1.00 1.00 0.0%
icroBenchmarks/Builtins/Int128/Builtins 12.00 12.00 12.00 0.0%
Geomean difference 0.4%
gvn.NumPRELoad
run base sameunderlying-and-nullptr sameunderlying diff
count 194.000000 194.000000 194.000000 194.000000
mean 74.097938 73.695876 73.695876 0.004618
std 186.856476 184.798491 184.798491 0.044925
min 1.000000 1.000000 1.000000 0.000000
25% 2.000000 2.000000 2.000000 0.000000
50% 7.500000 7.000000 7.000000 0.000000
75% 42.000000 42.000000 42.000000 0.000000
max 1133.000000 1061.000000 1061.000000 0.571429
Tests: 2432
Metric: gvn.NumPRELoopLoad
Program gvn.NumPRELoopLoad
base sameunderlying-and-nullptr sameunderlying diff
MicroBench...ubsetALambdaLoops/lcalsALambda 1.00 1.00 1.00 0.0%
MultiSourc...marks/Prolangs-C++/simul/simul 1.00 1.00 1.00 0.0%
MultiSourc...chmarks/Prolangs-C/agrep/agrep 4.00 4.00 4.00 0.0%
MultiSourc...marks/Prolangs-C/bison/mybison 17.00 17.00 17.00 0.0%
MultiSourc...chmarks/Prolangs-C/cdecl/cdecl 1.00 1.00 1.00 0.0%
MultiSourc...s/Prolangs-C/compiler/compiler 1.00 1.00 1.00 0.0%
MultiSourc...s/Prolangs-C/football/football 1.00 1.00 1.00 0.0%
MultiSourc...Prolangs-C/simulator/simulator 1.00 1.00 1.00 0.0%
MultiSourc...hmarks/Ptrdist/anagram/anagram 1.00 1.00 1.00 0.0%
MultiSourc...Benchmarks/Ptrdist/yacr2/yacr2 4.00 4.00 4.00 0.0%
MultiSourc...enchmarks/mafft/pairlocalalign 5.00 5.00 5.00 0.0%
MultiSourc...iabench/g721/g721encode/encode 1.00 1.00 1.00 0.0%
MultiSourc...nch/mpeg2/mpeg2dec/mpeg2decode 1.00 1.00 1.00 0.0%
MultiSource/Benchmarks/nbench/nbench 1.00 1.00 1.00 0.0%
SingleSour...nchmarks/Adobe-C++/loop_unroll 130.00 130.00 130.00 0.0%
Geomean difference 0.0%
gvn.NumPRELoopLoad
run base sameunderlying-and-nullptr sameunderlying diff
count 45.000000 45.000000 45.000000 45.0
mean 15.711111 15.711111 15.711111 0.0
std 37.860163 37.860163 37.860163 0.0
min 1.000000 1.000000 1.000000 0.0
25% 1.000000 1.000000 1.000000 0.0
50% 1.000000 1.000000 1.000000 0.0
75% 6.000000 6.000000 6.000000 0.0
max 168.000000 168.000000 168.000000 0.0
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143129/new/
https://reviews.llvm.org/D143129
More information about the llvm-commits
mailing list