Results for VRP based Zero/Sign Extensions Elimination

Rational

When GIMPLE_ASSIGN stmts with LHS type smaller than word is expanded to rtl, if we can prove that RHS expression value can always fit in LHS type and there is no sign conversion, truncation and extension to fit the type is redundant. Subreg and Zero/sign extensions are therefore redundant.

For example, when an expression is evaluated and it's value is assigned to variable of type short, the generated rtl would look something like the following.

(set (reg:SI 110)

  • (zero_extend:SI (subreg:HI (reg:SI 117) 0)))

However, if during value range propagation, if we can say for certain that the value of the expression which is present in register 117 is within the limits of short and there is no sign conversion, we don’t need to perform the subreg and zero_extend; instead we can generate the following rtl.

(set (reg:SI 110)

  • (reg:SI 117)))

Branch

https://code.launchpad.net/~kugan-vivekanandarajah/gcc-linaro/vrp_zero_sign_extension

Results

Results for spec2k

Name

Runtime with the patch as a ratio with respect to base case (smaller the better)

gzip

0.9698275862

vpr

1.0311111111

gcc

0.9666666667

mcf

0.9054545455

crafty

1

parser

0.9342560554

eon

0.9928498468

perlmbk

0.9351351351

gap

1.0042417815

vortex

1.005

bzip2

0.9903846154

twolf

0.7961783439

Results for Benchmark C As for the Benchmark C, there is a performance regression with this patch due to missing patterns due to RSHIFT_EXPR and BIT_IOR_EXPR. If we disable processing for these instructions, performance improves.

kuganvivekanandarajah/sandbox/vrp_zerosignextensions (last modified 2013-05-13 01:58:21)