Before merging two instructions together, GISel does some sanity checks that the folding is legal.
However that check was missing that the source of the pattern may be convergent. When the destination location is in a different basic block, the folding is invalid.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Hi @arsenm ,
Do you know if AMDGPU has any convergent instruction involved in pattern with folding?
I could use that to create a test case.
Cheers,
-Quentin
I'm not sure what context this gets called in. Maybe it's possible to hit this for DPP instructions?
llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp | ||
---|---|---|
63 | The block based check will probably break down with convergence tokens. Could this just skip convergent altogether? |
I'm not sure what context this gets called in. Maybe it's possible to hit this for DPP instructions?
This is called during instruction selection from the patterns that have been generated from SDISel.
Essentially, if you have a Pat that takes two or more instructions and fold them.
Thanks for the pointer, I'll take a look.
llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp | ||
---|---|---|
63 | We could, but I was worried this would introduce regressions when the pattern would legitimately apply. When the convergence tokens land (they are not landed right?), we'll have to fix SDISel, so maybe it is okay to have to fix GISel at that point? What do you think? |
I looked and don't see anything for this. We fold all of these in separate MI passes
llvm/lib/CodeGen/GlobalISel/InstructionSelector.cpp | ||
---|---|---|
63 | OK, I guess this can match. Basically every isConvergent check will probably be broken anyway |
I looked and don't see anything for this. We fold all of these in separate MI passes
Thanks for checking @arsenm !
That means I can't produce an open source test case unfortunately then.
Are you okay with the patch as is?
The block based check will probably break down with convergence tokens. Could this just skip convergent altogether?