Skip to content

[VPlan] Add incoming_[blocks,values] iterators to VPPhiAccessors (NFC) #138472

Merged
fhahn merged 22 commits into
llvm:mainfrom
fhahn:vplan-phi-iterators
Aug 14, 2025
Merged

[VPlan] Add incoming_[blocks,values] iterators to VPPhiAccessors (NFC) #138472
fhahn merged 22 commits into
llvm:mainfrom
fhahn:vplan-phi-iterators

Conversation

@fhahn

@fhahn fhahn commented May 4, 2025

Copy link
Copy Markdown
Contributor

Add 3 new iterator ranges to VPPhiAccessors

  • incoming_values(): returns a range over the incoming
    values of a phi
  • incoming_blocks(): returns a range over the incoming
    blocks of a phi
  • incoming_values_and_blocks: returns a range over pairs of
    incoming values and blocks.

Depends on #124838.

@fhahn fhahn requested review from aniragil, ayalz and rengolin May 4, 2025 21:02
fhahn added a commit that referenced this pull request May 15, 2025
…24838)

Update the verifier to verify dominance for incoming values for phi-like
recipes. The defining recipe must dominate the incoming block for the
incoming value.

Builds on top of #138472 to
retrieve incoming values & corresponding blocks for phi-like recipes.

PR: #124838
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request May 15, 2025
…ecipes. (#124838)

Update the verifier to verify dominance for incoming values for phi-like
recipes. The defining recipe must dominate the incoming block for the
incoming value.

Builds on top of llvm/llvm-project#138472 to
retrieve incoming values & corresponding blocks for phi-like recipes.

PR: llvm/llvm-project#124838
@fhahn fhahn requested review from alexey-bataev and lukel97 August 1, 2025 14:11

@fhahn fhahn left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping :)

Comment thread llvm/lib/Transforms/Vectorize/VPlan.h Outdated
Comment thread llvm/lib/Transforms/Vectorize/VPlan.h Outdated
Comment thread llvm/lib/Transforms/Vectorize/VPlan.h

@lukel97 lukel97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the PR title need updated? VPPhiAccessors was already added in #129388, this is adding more methods to it right?

Comment thread llvm/lib/Transforms/Vectorize/VPlan.h Outdated
@fhahn fhahn changed the title [VPlan] Add VPPhiAccessors to provide interface for phi recipes (NFC) [VPlan] Add incoming_[blocks,values] iterators to VPPhiAccessors (NFC) Aug 6, 2025

@fhahn fhahn left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the PR title need updated? VPPhiAccessors was already added in #129388, this is adding more methods to it right?

Yep, updated, thanks

Comment thread llvm/lib/Transforms/Vectorize/VPlan.h Outdated
Comment thread llvm/lib/Transforms/Vectorize/VPlan.h Outdated
Comment thread llvm/lib/Transforms/Vectorize/VPlan.h

@artagnon artagnon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

OperandsWithMask.push_back(InVPV);
VPValue *EdgeMask = getEdgeMask(InVPBB, VPBB);
if (!EdgeMask) {
assert(In == 0 && "Both null and non-null edge masks found");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there's not an easy way to preserve this assert?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope unfortunately not :(

Comment on lines +253 to +254
for (const auto &[IncomingVPV, IncomingVPBB] :
Phi->incoming_values_and_blocks()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not majorly important but if you wanted to preserve the error message you could do const auto &[Idx, IncomingVPV, IncomingVPBB] : enumerate(Phi->incoming_values(), Phi->incoming_blocks())

@lukel97

lukel97 commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

Reverse ping!

@fhahn fhahn merged commit 177f27d into llvm:main Aug 14, 2025
9 checks passed
@fhahn fhahn deleted the vplan-phi-iterators branch August 14, 2025 15:47
llvm-sync Bot pushed a commit to arm/arm-toolchain that referenced this pull request Aug 14, 2025
…essors (NFC) (#138472)

Add 3 new iterator ranges to VPPhiAccessors

* incoming_values(): returns a range over the incoming
  values of a phi
* incoming_blocks(): returns a range over the incoming
  blocks of a phi
* incoming_values_and_blocks: returns a range over pairs of
   incoming values and blocks.

Depends on llvm/llvm-project#124838.

PR: llvm/llvm-project#138472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants