]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR rtl-optimization/79593
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Jan 2019 22:29:56 +0000 (22:29 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Jan 2019 22:29:56 +0000 (22:29 +0000)
* config/i386/i386.md (reg = mem; mem = reg): New define_peephole2.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267740 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386.md

index 3ef77184b994288b82bc08c8630757b0ef29c80e..10f8e1341b77e70662f8546310a0779c7584154f 100644 (file)
@@ -1,5 +1,8 @@
 2019-01-08  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/79593
+       * config/i386/i386.md (reg = mem; mem = reg): New define_peephole2.
+
        * config/rs6000/rs6000.c (rs6000_delegitimize_address): Delegitimize
        UNSPEC_FUSION_GPR to its argument.  Formatting fixes.
 
index c8123cb6caad09b106cb73a5f82102b12c2f6f8f..83124ccbeb3ace49a74e205dc11432b2a901f3a3 100644 (file)
                       const0_rtx);
 })
 
+;; Attempt to optimize away memory stores of values the memory already
+;; has.  See PR79593.
+(define_peephole2
+  [(set (match_operand 0 "register_operand")
+        (match_operand 1 "memory_operand"))
+   (set (match_operand 2 "memory_operand") (match_dup 0))]
+  "!MEM_VOLATILE_P (operands[1])
+   && !MEM_VOLATILE_P (operands[2])
+   && rtx_equal_p (operands[1], operands[2])
+   && !reg_overlap_mentioned_p (operands[0], operands[2])"
+  [(set (match_dup 0) (match_dup 1))])
+
 ;; Attempt to always use XOR for zeroing registers (including FP modes).
 (define_peephole2
   [(set (match_operand 0 "general_reg_operand")