Commit 06c1602a by Segher Boessenkool

rs6000: Make CSE'ing __tls_get_addr calls possible

CSE does not consider calls, not even const calls.  This patch puts a
REG_EQUAL note on the pseudo we assign the __tls_get_addr result to,
so that those pseudos can be CSE'd and the extra calls deleted as dead
code.

CSE should really handle const calls directly, but it is stage 4.


	* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Add REG_EQUAL
	notes for the result of the __tls_get_addr calls.
	* config/rs6000/rs6000.md (unspec UNSPEC_TLS_GET_ADDR): New.

From-SVN: r269902
parent 38a47a0f
2019-03-26 Jeff Law <law@redhat.com>
2019-03-24 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Add REG_EQUAL
notes for the result of the __tls_get_addr calls.
* config/rs6000/rs6000.md (unspec UNSPEC_TLS_GET_ADDR): New.
2019-03-24 Jeff Law <law@redhat.com>
* config/bfin/bfin.md (movpdi): Fix length for alternative 1.
......
......@@ -8785,6 +8785,11 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
else
emit_library_call_value (tga, dest, LCT_CONST, Pmode);
global_tlsarg = NULL_RTX;
/* Make a note so that the result of this call can be CSEd. */
rtvec vec = gen_rtvec (1, copy_rtx (arg));
rtx uns = gen_rtx_UNSPEC (Pmode, vec, UNSPEC_TLS_GET_ADDR);
set_unique_reg_note (get_last_insn (), REG_EQUAL, uns);
}
else if (model == TLS_MODEL_LOCAL_DYNAMIC)
{
......@@ -8803,6 +8808,11 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model)
emit_library_call_value (tga, tmp1, LCT_CONST, Pmode);
global_tlsarg = NULL_RTX;
/* Make a note so that the result of this call can be CSEd. */
rtvec vec = gen_rtvec (1, copy_rtx (arg));
rtx uns = gen_rtx_UNSPEC (Pmode, vec, UNSPEC_TLS_GET_ADDR);
set_unique_reg_note (get_last_insn (), REG_EQUAL, uns);
if (rs6000_tls_size == 16)
{
if (TARGET_64BIT)
......@@ -79,6 +79,7 @@
UNSPEC_MPIC_CORRECT ; macho_correct_pic
UNSPEC_TLSGD
UNSPEC_TLSLD
UNSPEC_TLS_GET_ADDR
UNSPEC_MOVESI_FROM_CR
UNSPEC_MOVESI_TO_CR
UNSPEC_TLSDTPREL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment