Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline

tobias-stadler (Tobias Stadler)
User

Projects

User does not belong to any projects.

User Details

User Since
Nov 13 2022, 2:44 PM (55 w, 6 d)

Recent Activity

Nov 1 2023

tobias-stadler committed rGba0763e4cb08: [GlobalISel][M68k] Update test after 373c343 (authored by tobias-stadler).
[GlobalISel][M68k] Update test after 373c343
Nov 1 2023, 8:10 PM · Restricted Project, Restricted Project
tobias-stadler closed D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.
Nov 1 2023, 4:18 PM · Restricted Project, Restricted Project
tobias-stadler committed rG373c343a77a7: Reland: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND (authored by tobias-stadler).
Reland: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND
Nov 1 2023, 4:18 PM · Restricted Project, Restricted Project
tobias-stadler updated the diff for D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.

Rebase, fix tests, and rerun CI before relanding.

Nov 1 2023, 12:03 PM · Restricted Project, Restricted Project
tobias-stadler reopened D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.

This was reverted due to an issue fixed by https://github.com/llvm/llvm-project/pull/68840 and should now be ready to reland.

Nov 1 2023, 12:00 PM · Restricted Project, Restricted Project

Sep 28 2023

tobias-stadler added a reverting change for D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND: rG305fbc1b3203: Revert "[GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND".
Sep 28 2023, 6:45 PM · Restricted Project, Restricted Project
tobias-stadler added a reverting change for rG3686a0b611c6: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND: rG305fbc1b3203: Revert "[GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND".
Sep 28 2023, 6:45 PM · Restricted Project, Restricted Project
tobias-stadler committed rG305fbc1b3203: Revert "[GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND" (authored by tobias-stadler).
Revert "[GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND"
Sep 28 2023, 6:45 PM · Restricted Project, Restricted Project
tobias-stadler closed D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.
Sep 28 2023, 5:15 PM · Restricted Project, Restricted Project
tobias-stadler committed rG3686a0b611c6: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND (authored by tobias-stadler).
[GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND
Sep 28 2023, 5:15 PM · Restricted Project, Restricted Project
tobias-stadler updated the diff for D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.

Fix broken test.

Sep 28 2023, 2:19 PM · Restricted Project, Restricted Project
tobias-stadler updated the diff for D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.

Add suggested comment + Rebase.

Sep 28 2023, 12:46 PM · Restricted Project, Restricted Project

Sep 27 2023

tobias-stadler added a comment to D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.

@arsenm @aemerson Hi, do you have any further comments on this or are you ok with this change?

Sep 27 2023, 2:57 PM · Restricted Project, Restricted Project

Sep 25 2023

tobias-stadler updated the diff for D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.

Rebase.

Sep 25 2023, 6:18 PM · Restricted Project, Restricted Project

Sep 12 2023

tobias-stadler added a comment to D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.

Gentle Ping.

Sep 12 2023, 4:20 PM · Restricted Project, Restricted Project
tobias-stadler committed rG721b3d0a0220: [GlobalISel] GISelKnownBits: forward unused depth parameter (authored by tobias-stadler).
[GlobalISel] GISelKnownBits: forward unused depth parameter
Sep 12 2023, 3:39 PM · Restricted Project, Restricted Project
tobias-stadler closed D159321: [GlobalISel] GISelKnownBits: forward unused depth parameter.
Sep 12 2023, 3:39 PM · Restricted Project, Restricted Project

Aug 31 2023

tobias-stadler requested review of D159321: [GlobalISel] GISelKnownBits: forward unused depth parameter.
Aug 31 2023, 5:58 PM · Restricted Project, Restricted Project

Aug 30 2023

tobias-stadler added inline comments to D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.
Aug 30 2023, 4:51 PM · Restricted Project, Restricted Project
tobias-stadler added inline comments to D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.
Aug 30 2023, 10:11 AM · Restricted Project, Restricted Project
tobias-stadler added a comment to D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.

I see what you mean now. Is there any code size impact with optimizations (-Os or -O3)? I expect there to be none but just want to check.

Aug 30 2023, 8:41 AM · Restricted Project, Restricted Project
tobias-stadler added inline comments to D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.
Aug 30 2023, 7:28 AM · Restricted Project, Restricted Project
tobias-stadler added inline comments to D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.
Aug 30 2023, 6:44 AM · Restricted Project, Restricted Project
tobias-stadler added a comment to D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.

We only emit the mask G_CONSTANT when necessary. Even when the G_AND is combined away later, the constant sometimes ends up being reused by other instructions instead of becoming dead.

I'm a bit confused by how this could happen. Does this happen with optimizations?

The wording suggests that a later transform needs a G_AND, and probably the CSEMIRBuilder returns a reference to dead one? Why would other instructions need a dead instruction?

Aug 30 2023, 6:25 AM · Restricted Project, Restricted Project

Aug 29 2023

tobias-stadler updated the summary of D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.
Aug 29 2023, 9:23 PM · Restricted Project, Restricted Project
tobias-stadler requested review of D159140: [GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND.
Aug 29 2023, 2:18 PM · Restricted Project, Restricted Project

Jun 23 2023

tobias-stadler added a comment to D153164: [AArch64][GlobalISel] Select G_UADDE/G_SADDE/G_USUBE/G_SSUBE.

LGTM. Thanks for the nice improvements.

Jun 23 2023, 2:19 PM · Restricted Project, Restricted Project

Jun 22 2023

tobias-stadler added a comment to D153164: [AArch64][GlobalISel] Select G_UADDE/G_SADDE/G_USUBE/G_SSUBE.

Register getCarryOutReg();

For subtraction this is actually a borrow-out. This naming can be confusing.
Has anyone though about deviating from SelectionDAG here and inverting the meaning of the flag for subtractions, so that it is actually a carry for both add/sub?
I understand that we can't just invert the meaning, because many clients (including downstream) rely on the current behavior.
So maybe via deprecation? UADDE/UADDO aren't good names anyway (I still can't figure out what do E and O letters mean).

(not related to this review)
I also had this idea about adding a variant of all ALU operations with status flags output (NZVC), and using this output in G_BRCOND_S/G_SELECT_S along with condition code to test (e.g. "overflow set, zero clear").
Carry-producing instructions could then be replaced by these more general instructions.
This allows eliminating G_ICMP in many cases (and actually make G_ICMP redundant because it could be replaced with G_SUB_S with status flags output).
For example if ((x & y) <= 0) could be translated into G_AND_S + G_BRCOND_S with "not positive" condition code (N == 0 || Z == 0), if the target has one.
I've implemented this as custom nodes in a downstream SelectionDAG as proof of concept. It works, but there are some subtleties, and it is somewhat machine dependent (e.g. RISC-V does not have status flags, as far as I know).

I'm not very familiar with GISel, nor I have time to try to implement this idea upstream, but maybe it will interest someone.

Jun 22 2023, 11:10 AM · Restricted Project, Restricted Project

Jun 21 2023

tobias-stadler updated the diff for D153164: [AArch64][GlobalISel] Select G_UADDE/G_SADDE/G_USUBE/G_SSUBE.

Address comments. Thanks for the suggestions. I think the ifs and switches cleaned up quite nicely using the new helper classes.
My original train of thought behind the switch in emitCarryIn was that if anyone wanted to add support for carry-in setting of other instructions they would have to explicitly add their instruction and think about if they needed a negated carry and could opt-in to the optimizations only if they wanted to. I can't think of any other usecase though, so emitting the carry as-is also seems like a sane default.

Jun 21 2023, 9:03 AM · Restricted Project, Restricted Project

Jun 17 2023

tobias-stadler added a comment to D153164: [AArch64][GlobalISel] Select G_UADDE/G_SADDE/G_USUBE/G_SSUBE.

How did you noticed the fallback?
They were marked as legal, but there was no support in instruction selection?

Jun 17 2023, 10:41 AM · Restricted Project, Restricted Project
tobias-stadler updated the diff for D153164: [AArch64][GlobalISel] Select G_UADDE/G_SADDE/G_USUBE/G_SSUBE.

Update commit summary to include fixed issue. Thanks.

Jun 17 2023, 10:08 AM · Restricted Project, Restricted Project
tobias-stadler updated the diff for D153164: [AArch64][GlobalISel] Select G_UADDE/G_SADDE/G_USUBE/G_SSUBE.

Address comments. Thanks.

Jun 17 2023, 10:05 AM · Restricted Project, Restricted Project

Jun 16 2023

tobias-stadler added a comment to D153165: Select `G_SADDE`, `G_UADDE`, `G_SSUBE` and `G_USUBE` for AArch64.

I fixed these same issues here https://reviews.llvm.org/D153164 2 minutes earlier. I do generate better code though, because I generate less instructions for carry-in setting and optimize these instructions away whenever possible. For >O0 I generate identical code to SelectionDag. I also have higher test coverage.

Jun 16 2023, 1:48 PM · Restricted Project, Restricted Project
tobias-stadler requested review of D153164: [AArch64][GlobalISel] Select G_UADDE/G_SADDE/G_USUBE/G_SSUBE.
Jun 16 2023, 12:54 PM · Restricted Project, Restricted Project