]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: check for low register before applying peephole [PR113510]
authorRichard Earnshaw <rearnsha@arm.com>
Tue, 5 Mar 2024 17:21:43 +0000 (17:21 +0000)
committerRichard Earnshaw <rearnsha@arm.com>
Tue, 5 Mar 2024 17:21:43 +0000 (17:21 +0000)
For thumb1, when using a peephole to fuse

mov reg, #const
add reg, reg, SP

into

add reg, SP, #const

we must first check that reg is a low register, otherwise we will ICE
when trying to recognize the resulting insn.

gcc/ChangeLog:

PR target/113510
* config/arm/thumb1.md (peephole2 to fuse mov imm/add SP): Use
low_register_operand.

gcc/config/arm/thumb1.md

index 14d6df580afe5d5685afdfd1b7d31258d5c14c77..d7074b43f6011b25842f6698c73e721ea65016c2 100644 (file)
 ;; Reloading and elimination of the frame pointer can
 ;; sometimes cause this optimization to be missed.
 (define_peephole2
-  [(set (match_operand:SI 0 "arm_general_register_operand" "")
+  [(set (match_operand:SI 0 "low_register_operand" "")
        (match_operand:SI 1 "const_int_operand" ""))
    (set (match_dup 0)
        (plus:SI (match_dup 0) (reg:SI SP_REGNUM)))]