This revision explicitly specifies the machine instruction properties instead of relying on guesswork. This is because guessing instruction properties has proven to be inaccurate, such as the machine LICM not working:
void func(char *a, char *b) { int i; for (i = 0; i != 72526; i++) a[i] = b[i]; }
Guessing instruction properties:
func: # @func # %bb.0: move $a2, $zero .LBB0_1: # =>This Inner Loop Header: Depth=1 ldx.b $a3, $a1, $a2 stx.b $a3, $a0, $a2 addi.d $a2, $a2, 1 lu12i.w $a3, 17 ori $a3, $a3, 2894 bne $a2, $a3, .LBB0_1 # %bb.2: ret .Lfunc_end0:
Explicitly specify instruction properties:
func: # @func # %bb.0: lu12i.w $a2, 17 ori $a2, $a2, 2894 move $a3, $zero .LBB0_1: # =>This Inner Loop Header: Depth=1 ldx.b $a4, $a1, $a3 stx.b $a4, $a0, $a3 addi.d $a3, $a3, 1 bne $a3, $a2, .LBB0_1 # %bb.2: ret .Lfunc_end0:
I checked PPC and RISCV and it seems prefetch instructions should have mayLoad = 1, mayStore = 1. Otherwise I expect them to get incorrectly optimized away...