https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118995

            Bug ID: 118995
           Summary: Missed optimization: [[assume]] works not as good as
                    std::unreachable()
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eugene.shalygin at gmail dot com
  Target Milestone: ---

Using [[assume(exp)]]; results in worse optimization than when the same
assumption is explained to the compiler via if (!expr) std::unreachable().
Don't know why implementations for these two differ, but there should be no
difference with respect to how they drop code branches?

Godbolt link with examples from #118933 and #109045:
https://godbolt.org/z/KT5zjsKo9

Reply via email to