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

--- Comment #17 from Lénárd Szolnoki <leni536 at gmail dot com> ---
(In reply to Andrew Pinski from comment #16)
> (In reply to Lénárd Szolnoki from comment #15)
> > > We get:
> > > depends_on_unpsecified_content(int):
> > >         stp     x29, x30, [sp, #-32]!
> > >         str     x19, [sp, #16]
> > >         mov     x29, sp
> > >         cbz     w0, .LBB1_2
> > >         mov     w19, w0
> > > 
> > > If we used gnu::noipa, then GCC does the same as LLVM does on the original
> > > testcase.
> > 
> > I don't see the same issue manifesting, this looks like correct inlining and
> > optimizations to me. Also, the original issue for GCC manifested in `main`,
> > not in `depends_on_unspecified_content` (or `f` in the godbolt). The codegen
> > for `depends_on_unspecified_content` is fine in both clang and gcc.
> 
> Try to use depends_on_unpsecified_content or m from a tu compiled with gcc
> at -O0 and you would get the same incorrect behavior

I still don't follow. Clang's codegen doesn't call either
depends_on_unpsecified_content or m anywhere, so how could it call an -O0
version from GCC?

https://godbolt.org/z/rKEeqfjhe

If you mean that the behavior is different between clang and gcc for each of
these functions is itself not the issue. The unspecified behavior is allowed to
change from call-to-call.

The only issue is with assuming specific manifestations of unspecified behavior
within a non-inlined vague linkage function *and* doing IPA optimizations based
on that on the caller side. This is manifested in `main` in the issue
description, but not in other functions.

As the only non-inlined calls in the clang codegen is to `g` and `abort`, I
don't see how it could possibly showcase this issue.

Reply via email to