transform: use IPSCCP pass instead of the constant propagation pass

The constant propagation pass is removed in LLVM 12, so this pass needs
to be replaced anyway. The direct replacement would be the SCCP (sparse
conditional constant propagation) pass, but perhaps a better replacement
is the IPSCCP pass, which is an interprocedural version of the SCCP
pass and propagates constants across function calls if possible.

This is not always a code size reduction, but it appears to reduce code
size in a majority of cases. It certainly reduces code size in almost
all WebAssembly tests I did.
Этот коммит содержится в:
Ayke van Laethem 2021-04-05 23:45:36 +02:00 коммит произвёл Ron Evans
родитель 56cf69a66b
коммит 25dac32a88

Просмотреть файл

@ -56,7 +56,7 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
defer goPasses.Dispose()
goPasses.AddGlobalDCEPass()
goPasses.AddGlobalOptimizerPass()
goPasses.AddConstantPropagationPass()
goPasses.AddIPSCCPPass()
goPasses.AddAggressiveDCEPass()
goPasses.AddFunctionAttrsPass()
goPasses.Run(mod)