Skip to content

Add a default constructor to llvm::SuccIterator (gcc15) - #24

Merged
akritkbehera merged 1 commit into
cms-externals:cms/v2.21.0from
akritkbehera:cms/v2.21.0-gcc15
Sep 3, 2026
Merged

Add a default constructor to llvm::SuccIterator (gcc15)#24
akritkbehera merged 1 commit into
cms-externals:cms/v2.21.0from
akritkbehera:cms/v2.21.0-gcc15

Conversation

@akritkbehera

Copy link
Copy Markdown

No description provided.

Compiling llvm/lib/IR/Dominators.cpp against the gcc15 libstdc++ fails with

  stl_iterator.h:182: error: no matching constructor for initialization of
  'llvm::SuccIterator<llvm::Instruction, llvm::BasicBlock>'

libstdc++ 15 declares std::reverse_iterator's default constructor as
noexcept(noexcept(Iterator())). Asking whether a reverse_iterator over
succ_iterator is default constructible -- the C++20 semiregular check the
ranges code does -- forces that exception specification to be instantiated,
and an error inside an exception specification is hard rather than a SFINAE
failure, so the concept never gets to simply answer "no" and the build dies.
libstdc++ 14 has no such noexcept clause, which is why gcc14 is fine.

SuccIterator declares only the begin (InstructionT *) and end (InstructionT *,
bool) constructors, so it has no default one. PredIterator, right above it in
the same header, already carries "PredIterator() = default;" for this reason.

Add SuccIterator() : Inst(nullptr), Idx(0) {}. A null Inst with Idx == 0 is a
state the class already supports: the end-iterator constructor uses it for
malformed CFGs and index_is_valid() special cases it, so a default constructed
iterator behaves like one over a block with no successors. Zero initialising is
better than "= default" here, which would leave the pointer and the index
indeterminate. There is nothing to backport from upstream -- LLVM main has since
folded SuccIterator into Instruction.

The hunk rewrites the "// begin iterator" comment rather than being a pure
insertion, because bazel's ctx.patch (third_party/repo.bzl applies these with
strip = 1) has been seen to silently skip insertion-only hunks, as with the
oneDNN fmt_consteval patch.
@akritkbehera
akritkbehera merged commit bc673ee into cms-externals:cms/v2.21.0 Sep 3, 2026
1 of 2 checks passed
@cmsbuild

cmsbuild commented Sep 3, 2026

Copy link
Copy Markdown

A new Pull Request was created by @akritkbehera for branch cms/v2.21.0.

@akritkbehera, @cmsbuild, @iarspider, @raoatifshad, @smuzaffar can you please review it and eventually sign? Thanks.
@ftenchini, @mandrenguyen, @sextonkennedy you are the release manager for this.
cms-bot commands are listed here

@cmsbuild

cmsbuild commented Sep 3, 2026

Copy link
Copy Markdown

cms-bot internal usage

@akritkbehera

Copy link
Copy Markdown
Author

+externals

@cmsbuild

cmsbuild commented Sep 3, 2026

Copy link
Copy Markdown

This pull request is fully signed and it will be integrated in one of the next cms/v2.21.0 IBs after it passes the integration tests. This pull request will now be reviewed by the release team before it's merged. @mandrenguyen, @ftenchini, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants