[MIPS] Select/Add combiner error with gp_rel addresses
The instruction combiner optimizes (select (add $gp %gp_rel(a)) (add $gp %gp_rel(b))) into (add $gp (select %gp_rel(a) %gp_rel(b))). This then fails instruction selection because there's no matching rule.
Error here seems to be with the combiner step: the combiner should not be performing this optimization if one of the operands to the binary op is a legal immediate for that operation since this will unnecessarily materialize the constant.
Steps to reproduce:
RUN: llc -mtriple=mips -mcpu=mips32 -relocation-model=static -mgpopt -mattr=+noabicalls < llvm/test/CodeGen/Mips/cmov.ll
@llvm/issue-subscribers-backend-mips
Author: keithdunwoody
Error here seems to be with the combiner step: the combiner should not be performing this optimization if one of the operands to the binary op is a legal immediate for that operation since this will unnecessarily materialize the constant.
Steps to reproduce:
RUN: llc -mtriple=mips -mcpu=mips32 -relocation-model=static -mgpopt -mattr=+noabicalls < llvm/test/CodeGen/Mips/cmov.ll
Hey could i take this up?
I do have a potential patch, but need to clean it up a bit.
@david04g : All yours if you still want to take this up. A different approach than what I'd taken was requested, and I don't have the time to completely pivot. See comments in the PR for more details.
I'll get to work on it and see what i can do
@keithdunwoody @dtcxzyw forgot to ping but PR should be in line with what was disscussed in the PR rejection.