[PATCH] RISC-V: Produce better code with complex constants [PR95632] [PR106602]

Jeff Law jeffreyalaw@gmail.com
Thu Dec 8 18:15:47 GMT 2022



On 12/8/22 10:53, Palmer Dabbelt wrote:
> On Wed, 07 Dec 2022 12:55:17 PST (-0800), rzinsly@ventanamicro.com wrote:
>> Due to RISC-V limitations on operations with big constants combine
>> is failing to match such operations and is not being able to
>> produce optimal code as it keeps splitting them. By pretending we
>> can do those operations we can get more opportunities for
>> simplification of surrounding instructions.
> 
> I saw Jeff's comments.  This is always the kind of thing that worries 
> me: we're essentially lying to the optimizer in order to trick it into 
> generating better code, which might just make it generate worse code. 
> It's always easy to see a small example that improves, but those could 
> be wiped out by secondary effects in real code.  So I'd usually want to 
> have some benchmarking for a patch like this.
> 
> That said, if this is just the standard way of doing things then maybe 
> it's just fine?
Bridge combiner patterns are pretty standard.  The insn's condition of 
cse_not_expected is also in there to minimize the potential for 
surprises by not exposing this too early.

jeff


More information about the Gcc-patches mailing list