https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115943

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
x86_64:
```
_ZN7MyClass4callEv:
.LVL0:
.LFB1:
        .file 1 "/app/example.cpp"
        .loc 1 7 22 view -0
        .cfi_startproc
        .loc 1 8 5 view .LVU1
        .loc 1 8 23 is_stmt 0 view .LVU2
        movb    $1, 0
        .loc 1 9 1 view .LVU3
        ret
        .cfi_endproc
```
aarch64:
```
_ZN7MyClass4callEv:
.LVL0:
.LFB1:
        .file 1 "/app/example.cpp"
        .loc 1 7 22 view -0
        .cfi_startproc
        .loc 1 8 5 view .LVU1
        .loc 1 8 23 is_stmt 0 view .LVU2
        mov     x0, 0
.LVL1:
        .loc 1 8 23 view .LVU3
        mov     w1, 1
        strb    w1, [x0]
        .loc 1 9 1 view .LVU4
        ret
        .cfi_endproc
```

I am not sure this is a bug. line 7 is the start of the function, the open `{`.
line 8 is the complete statement.

In the case of x86_64 there is only one instruction which is for both
statements. While in aarch64 there are 2 (well 3) instructions available. One
of the nullptr and 2 for the store.

The gimple dump is:
```
;;   starting at line 8
  [/app/example.cpp:8:5] # DEBUG BEGIN_STMT
  [/app/example.cpp:8:23] # .MEM_2 = VDEF <.MEM_1(D)>
  [/app/example.cpp:8:5] MEM[(charD.11 *)0B] = 1;
  [/app/example.cpp:9:1] # VUSE <.MEM_2>
```
Which is exactly what you expect.

Expand is:
```
(note 4 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(insn 2 4 3 2 (set (reg/f:DI 98 [ thisD.2813 ])
        (reg:DI 5 di [ thisD.2813 ])) "/app/example.cpp":7:22 -1
     (nil))
(note 3 2 6 2 NOTE_INSN_FUNCTION_BEG)
(debug_insn 6 3 7 2 (debug_marker) "/app/example.cpp":8:5 -1
     (nil))
(insn 7 6 8 2 (set (reg/f:DI 99)
        (const_int 0 [0])) "/app/example.cpp":8:23 -1
     (nil))
(insn 8 7 0 2 (set (mem:QI (reg/f:DI 99) [0 [/app/example.cpp:8:5]
MEM[(charD.10 *)0B]+0 S1 A128])
        (const_int 1 [0x1])) "/app/example.cpp":8:23 -1
     (nil))
```

Which is even more of what you expect.

fwprop changes:
```
(debug_insn 6 3 8 2 (debug_marker) "/app/example.cpp":8:5 -1
     (nil))
(insn 7 6 8 2 (set (reg/f:DI 99)
        (const_int 0 [0])) "/app/example.cpp":8:23 88 {*movdi_internal}
     (nil))
(insn 8 7 0 2 (set (mem:QI (reg/f:DI 99) [0 [/app/example.cpp:8:5]
MEM[(charD.10 *)0B]+0 S1 A128])
        (const_int 1 [0x1])) "/app/example.cpp":8:23 91 {*movqi_internal}
     (expr_list:REG_DEAD (reg/f:DI 99)
        (nil)))
```
into:
```
(debug_insn 6 3 8 2 (debug_marker) "/app/example.cpp":8:5 -1
     (nil))
(insn 8 6 0 2 (set (mem:QI (const_int 0 [0]) [0 [/app/example.cpp:8:5]
MEM[(charD.10 *)0B]+0 S1 A128])
        (const_int 1 [0x1])) "/app/example.cpp":8:23 91 {*movqi_internal}
     (nil))
```

So nothing interesting and seems all  right.

Reply via email to