RISC-V: Fix epilogue generation for barrier.
authorJu-Zhe Zhong <juzhe.zhong@rivai.ai>
Tue, 25 Oct 2022 13:53:23 +0000 (21:53 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Wed, 26 Oct 2022 09:05:24 +0000 (17:05 +0800)
 I noticed that I have made a mistake in previous patch:
 https://patchwork.sourceware.org/project/gcc/patch/20220817071950.271762-1-juzhe.zhong@rivai.ai/

 The previous statement before this patch:
 bool need_barrier_p = (get_frame_size () + cfun->machine->frame.arg_pointer_offset) != 0;

 However, I changed it in the previous patch:
 bool need_barrier_p = known_ne (get_frame_size (), cfun->machine->frame.arg_pointer_offset);
 This is incorrect.

 Now, I correct this statement in this patch.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_expand_epilogue): Fix statement.

gcc/config/riscv/riscv.cc

index fac8def..3d02954 100644 (file)
@@ -5025,8 +5025,8 @@ riscv_expand_epilogue (int style)
   rtx insn;
 
   /* We need to add memory barrier to prevent read from deallocated stack.  */
-  bool need_barrier_p
-    = known_ne (get_frame_size (), cfun->machine->frame.arg_pointer_offset);
+  bool need_barrier_p = known_ne (get_frame_size ()
+                                 + cfun->machine->frame.arg_pointer_offset, 0);
 
   if (cfun->machine->naked_p)
     {