This patch adds visitSelectInst() to find free Select IRs and continue the propagation of SimplifiedValues, ConstantOffsetPtrs, and SROAArgValues.
We don't need all operands of Select IR to be constants to fold it, so I don't use the generic CallAnalyzer::simplifyInstruction().
The impact on SPEC20xx is below
Benchmark | Code Size (%) | Perf (%) |
(+ is bigger) | (+ is faster) | |
spec2000/gcc | 0.01 | 1.08 |
spec2000/mesa | 0.04 | 2.2 |
spec2000/twolf | -0.15 | -0.01 |
spec2006/gcc | 0.02 | -0.19 |
spec2006/h264ref | 0.33 | 0.18 |
spec2017/blender | 0.01 | 0.5 |
spec2017/gcc | 0.01 | 0.09 |
spec2017/imagick | 0.02 | 0.01 |
spec2017/parest | 0 | -0.05 |
spec2017/perlbench | 0.1 | 0.56 |
Sorry, I should have thought through this carefully. My bad. I feel this version is worse than before. Most callers of simplifyInstruction pass a callable that takes a vector of Value * and implicitly treats it as a vector of Constant *. Feel free to go back the the previous version or come up with a better way to refactor simplifyInstruction. My main motivation for the refactoring was to keep accesses to SimplifiedValues in one location, so that we can get data on how often does inlining actually simplifies a value to a constant.