diff mbox series

rs6000: Make code questionably using r2 not ICE (PR94420)

Message ID 032f2366a4cd57f781f2093d977b9cf9600c83b8.1585760495.git.segher@kernel.crashing.org
State New
Headers show
Series rs6000: Make code questionably using r2 not ICE (PR94420) | expand

Commit Message

Segher Boessenkool April 1, 2020, 5:02 p.m. UTC
The example code in the PR uses r2 (the TOC register) directly.  In the
RTL generated for that, r2 is copied to some pseudo, and then cprop
propagates that into a "*tocref<mode>" insn, because nothing is
preventing it from doing that.

So, put the same condition in the insn condition for this as we will
later encounter in the constraint anyway, fixing this.

Tested on powerpc64-linux {-m32,-m64}.  Committed to master.

2020-04-01  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/94420
	* config/rs6000/rs6000.md (*tocref<mode> for P): Add insn condition
	on operands[1].
 gcc/config/rs6000/rs6000.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index dcccb03..11ab745 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -10311,7 +10311,8 @@  (define_insn "*largetoc_low_aix<mode>"
 (define_insn_and_split "*tocref<mode>"
   [(set (match_operand:P 0 "gpc_reg_operand" "=b")
 	(match_operand:P 1 "small_toc_ref" "R"))]
+    && legitimate_constant_pool_address_p (operands[1], QImode, false)"
    "la %0,%a1"
    "&& TARGET_CMODEL != CMODEL_SMALL && reload_completed"
   [(set (match_dup 0) (high:P (match_dup 1)))