Fix LRA bug

This patch fixes an ICE building libgfortran/random.c.

The problem was an adddi3 instruction that had an eliminable frame pointer.
GCN adddi3 includes a match_scratch, which LRA substitutes with a REG, and
checks if it can be converted back to a scratch afterwards.  In the meantime,
the add was converted to a move, meaning that the instruction pattern
completely changed, thus causing a segfault when the instruction is revisited
in restore_scratches.

2018-12-14  Andrew Stubbs  <>

	* gcc/lra-int.h (lra_register_new_scratch_op): Add third parameter.
	* gcc/lra-remat.c (update_scratch_ops): Pass icode to
	* gcc/lra.c (struct sloc): Add icode field.
	(lra_register_new_scratch_op): Add icode parameter.
	Use icode to skip insns that have changed beyond recognition.

git-svn-id: svn+ssh:// 138bc75d-0d04-0410-961f-82ee72b054a4
4 files changed