Skip to content

Conversation

@fhahn
Copy link

@fhahn fhahn commented Nov 14, 2025

…ns. (llvm#166945)

Currently sinking assumes in instcombine drops assumes if they would prevent sinking. Removing dereferenceable assumptions earlier on can inhibit vectorization of early-exit loops in practice.

Special-case deferenceable assumptions so that they block sinking. This can be combined with a separate change to drop dereferencebale assumptions after vectorization: https://clang.godbolt.org/z/jGqcx3sbs

PR: llvm#166945

(cherry picked from commit 700b77b)

@fhahn
Copy link
Author

fhahn commented Nov 14, 2025

@swift-ci please test

@fhahn fhahn force-pushed the pick-deref-ic-sinking branch from 358a805 to 05b2e8c Compare November 17, 2025 12:54
@fhahn
Copy link
Author

fhahn commented Nov 17, 2025

@swift-ci please test

@fhahn
Copy link
Author

fhahn commented Nov 17, 2025

@swift-ci please test llvm

// Do not sink if there are dereferenceable assumes that would be
// removed.
auto II = dyn_cast<IntrinsicInst>(User);
if (II->getIntrinsicID() != Intrinsic::assume ||
Copy link

@jroelofs jroelofs Nov 17, 2025

Choose a reason for hiding this comment

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

dyn_cast must always have a nullptr check

Copy link
Author

Choose a reason for hiding this comment

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

yeah done. (I think currently the only droppable uses appear to be intrinsics)

Choose a reason for hiding this comment

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

or you could do just cast<> if you think that’s better. I’m happy either way.

Copy link

@jroelofs jroelofs left a comment

Choose a reason for hiding this comment

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

LGTM with a check on the dyn_cast's result.

…ns. (llvm#166945)

Currently sinking assumes in instcombine drops assumes if they would
prevent sinking. Removing dereferenceable assumptions earlier on can
inhibit vectorization of early-exit loops in practice.

Special-case deferenceable assumptions so that they block sinking. This
can be combined with a separate change to drop dereferencebale
assumptions after vectorization: https://clang.godbolt.org/z/jGqcx3sbs

PR: llvm#166945

(cherry picked from commit 700b77b)
@fhahn fhahn force-pushed the pick-deref-ic-sinking branch from 05b2e8c to 1c40539 Compare November 17, 2025 18:34
@fhahn
Copy link
Author

fhahn commented Nov 17, 2025

@swift-ci please test

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