> After gcse1 a loop body contains the following two insns. Note that gcse
> has already replaced r974 with r1218 in insn 1743 and has attached a
> REG_EQUAL note. Insn 2308 stays as a dead store - maybe thats what confuses
> the loop optimizer.
>
> (insn 2308 1740 1743 111 (set (reg/f:DI 974)
>         (const:DI (unspec:DI [
>                     (symbol_ref:DI ("local") <var_decl 0x200004c9dc0
> local>) ] 110))) 49 {*movdi_larl} (nil)
>     (expr_list:REG_EQUAL (const:DI (unspec:DI [
>                     (symbol_ref:DI ("local") <var_decl 0x200004c9dc0
> local>) ] 110))
>         (nil)))
>
> (insn 1743 2308 1744 111 (set (reg/f:DI 973)
>         (mem/u/c:DI (reg/f:DI 1218) [0 S8 A8])) 51 {*movdi_64} (nil)
>     (expr_list:REG_EQUAL (mem/u/c:DI (reg/f:DI 974) [0 S8 A8])
>         (nil)))

The note doesn't look particularly helpful in this case, given that gcse
has replaced r974 with r1218 in the insn.  How is it created?

> The loop optmizer decided to load the src of insn 1743 into a new pseudo
> (the insert_temp flag is set) resulting in:
>
> (insn 2395 2394 2397 108 (set (reg:DI 1229)
>         (mem/u/c:DI (reg/f:DI 1218) [0 S8 A8])) -1 (nil)
>     (expr_list:REG_EQUAL (mem/u/c:DI (reg/f:DI 974) [0 S8 A8])
>         (nil)))
>
> before loop start and insn 2308 still in the loop body:
>
> (insn 2308 1740 2396 110 (set (reg/f:DI 974)
>         (const:DI (unspec:DI [
>                     (symbol_ref:DI ("local") <var_decl 0x200004c9dc0
> local>) ] 110))) -1 (nil)
>     (expr_list:REG_EQUAL (const:DI (unspec:DI [
>                     (symbol_ref:DI ("local") <var_decl 0x200004c9dc0
> local>) ] 110))
>         (nil)))

Is (reg/f:DI 974) loop invariant or only conditionally invariant?

-- 
Eric Botcazou

Reply via email to