[PATCH] D72034: [GlobalISel][RFC] Importing patterns with PtrValueType and nullptr
Petar Avramovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 3 01:32:04 PST 2020
Petar.Avramovic marked an inline comment as done.
Petar.Avramovic added a comment.
> G_CONSTANT can already directly have a pointer type, so I don't see a reason that the extra G_INTTOPTR needs to be involved.
When I started this patch I thought the same. nullptr was translated like that some time ago, D44762 <https://reviews.llvm.org/D44762> changed it to what we have now. NullPtrValue was meant to match IRTranslator's translation of llvm-ir null
> Are you trying to specifically select pointer differently from integers?
I am trying to select pointers/nullptr exectly like integers i.e. use gpr32/0.
Sdag td files already have Int_Src -> Int_Dst patterns.
I am trying to add Pointer_Src -> Int_Dst that will be used by GlobalISel only since it has pointers in intermediate representation.
It looks like this:
def : MipsPat<(seteq GPR32:$lhs, GPR32:$rhs),
(SLTiu (XOR GPR32:$lhs, GPR32:$rhs), 1)>;
def : MipsPat<(seteq p0:$lhs, p0:$rhs),
(SLTiu (XOR GPR32:$lhs, GPR32:$rhs), 1)>;
There should be fewer pointer patterns then integer patterns.
> I thought you could already get this to work without distinguishing them with PtrValueType.
If you think of changing pointer type to scalar before isel, I also think that could work (it works in sdag).
I asked about it in http://lists.llvm.org/pipermail/llvm-dev/2019-November/137041.html.
================
Comment at: llvm/test/CodeGen/Mips/GlobalISel/instruction-select/icmp.mir:19
+ define void @uge_ptr() {entry: ret void}
+ define void @ult_ptr() {entry: ret void}
+ define void @ule_ptr() {entry: ret void}
----------------
arsenm wrote:
> I don't think you need the IR section in this test at all
I see. I will take a look at other mir tests and fix them all together.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72034/new/
https://reviews.llvm.org/D72034
More information about the llvm-commits
mailing list