[Bug debug/100960] var-tracking: parameter location in subregister not tracked
stefansf at linux dot ibm.com
gcc-bugzilla@gcc.gnu.org
Thu Aug 11 09:25:43 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100960
--- Comment #5 from Stefan Schulze Frielinghaus <stefansf at linux dot ibm.com> ---
However, I found another example (see attachment a-t2.c.325r.vartrack) which
does not profit from the patch:
__attribute__((noinline, noclone)) void
fn1 (int x)
{
__asm volatile ("" : "+r" (x) : : "memory");
}
__attribute__((noinline, noclone)) int
fn2 (int x, int y)
{
if (x)
{
// x is copied into call-saved r11
fn1 (x);
// locs of x point to entry value only
// ignoring r11
fn1 (x);
}
return y;
}
__attribute__((noinline, noclone)) int
fn3 (int x, int y)
{
return fn2 (x, y);
}
int
main ()
{
fn3 (36, 25);
return 0;
}
For fn2 the value for parameter x is 5:5
cselib hash table:
...
(value/u:SI 5:5 @0x5fb9420/0x5f5e600)
locs:
from insn 1 (value/u:SI 6:263 @0x5fb9438/0x5f5e630)
from insn 1 (entry_value:SI (reg:SI 2 %r2 [ xD.2274 ]))
from insn 1 (reg:SI 2 %r2 [ xD.2274 ])
no addrs
which is recorded in bb 2. In bb 4 (the true branch of the if) register r2 is
saved in r11:
bb 4 op 0 insn 36 MO_VAL_USE (concat/v:DI (value/u:DI 26:26
@0x5fb9618/0x5f5e9f0)
(reg:DI 2 %r2 [64]))
bb 4 op 1 insn 36 MO_VAL_SET (concat/u:DI (value/u:DI 26:26
@0x5fb9618/0x5f5e9f0)
(set (reg/v:DI 11 %r11 [orig:61 xD.2274+-4 ] [61])
(reg:DI 2 %r2 [64])))
(insn 36 10 11 4 (set (reg/v:DI 11 %r11 [orig:61 xD.2274+-4 ] [61])
(reg:DI 2 %r2 [64])) 1472 {*movdi_64}
(nil))
cselib hash table:
(value/u:DI 26:26 @0x5fb9618/0x5f5e9f0)
locs:
from insn 36 (reg/v:DI 11 %r11 [orig:61 xD.2274+-4 ] [61])
from insn 36 (reg:DI 2 %r2 [64])
no addrs
cselib preserved hash table:
...
(value/u:SI 5:5 @0x5fb9420/0x5f5e600)
locs:
from insn 1 (value/u:SI 6:263 @0x5fb9438/0x5f5e630)
from insn 1 (entry_value:SI (reg:SI 2 %r2 [ xD.2274 ]))
no addrs
However at bb 4 the relation between r2 and value 5:5 is lost (except the entry
value relation). Thus I cannot record the subvalue relation between 5:5 and
26:26 at least not during creation of 26:26. Since cselib resets its table
after jumps I'm not sure how to proceed here. Any ideas?
I would be also up for the second idea and pretend that the move is not a
DImode copy but a SImode copy. However, I'm not sure how to look up the mode of
the actual type. Any pointers?
More information about the Gcc-bugs
mailing list