This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Do not remove labels with LABEL_PRESERVE_P


Hi,

During my work on enabling pseudo PIC register I've found that cfg cleaunp may remove lables with LABEL_PRESERVE_P set to 1.  In my case I generated SET_RIP during expand pass and cfg cleanup removed label it used as an operand.  Below is a patch that fixes it.  It is not actually required for our latest PIC related patch but still seems to make sense.

Bootstrapped and tested on linux-x86_64.

Thanks,
Ilya
--
2014-09-19  Ilya Enkovich  <ilya.enkovich@intel.com>

	* cfgcleanup.c (try_optimize_cfg): Do not remove label
	with LABEL_PRESERVE_P flag set.


diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index a008168..9325ea0 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -2701,6 +2701,7 @@ try_optimize_cfg (int mode)
 		  && (single_pred_edge (b)->flags & EDGE_FALLTHRU)
 		  && !(single_pred_edge (b)->flags & EDGE_COMPLEX)
 		  && LABEL_P (BB_HEAD (b))
+		  && !LABEL_PRESERVE_P (BB_HEAD (b))
 		  /* If the previous block ends with a branch to this
 		     block, we can't delete the label.  Normally this
 		     is a condjump that is yet to be simplified, but


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]