Implement Loop-invariant code motion / Hoisting for Cmm
Currently we don't but we should.
An example from nofib:
This is the innermost loop of fannkuch-redux.
ca12:
_s9D0::I64 = %MO_UU_Conv_W8_W64(I8[_s9zN::I64]);
if (_s9D0::I64 != 0) goto ca1f; else goto ca1i;
ca1f:
I64[Sp - 16] = ca1d;
R3 = _s9zN::I64 + _s9D0::I64;
R2 = _s9zN::I64;
I64[Sp - 8] = _s9CV::I64;
I64[Sp] = _s9Cd::I64;
I64[Sp + 40] = _s9Cc::I64;
I64[Sp + 48] = _s9Cb::I64;
I64[Sp + 56] = _s9zN::I64;
Sp = Sp - 16;
call $wflopp_r9x0_info(R3,
R2) returns to ca1d, args: 8, res: 8, upd: 8;
ca1d:
Sp = Sp + 16;
_s9CV::I64 = I64[Sp - 8] + 1;
_s9Cd::I64 = I64[Sp + 0]; 16
_s9z5::I64 = I64[Sp + 8]; //24
_s9zv::I64 = I64[Sp + 16]; 32
_s9zx::I64 = I64[Sp + 24]; 40
_s9zz::I64 = I64[Sp + 32]; 48
_s9Cc::I64 = I64[Sp + 40]; 56
_s9Cb::I64 = I64[Sp + 48]; 64
_s9zN::I64 = I64[Sp + 56]; 72
goto ca12;
We should try to move the loads NOT used in the loop out of the loop at least.
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.3 |
Type | Task |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |