[Bug c/28306] const / pure call with ignored argument emitted.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28306 Steven Bosscher changed: What|Removed |Added Last reconfirmed|2006-07-07 17:30:13 |2019-3-5 Host|i686-pc-linux-gnu | --- Comment #4 from Steven Bosscher --- GCC trunk today on x86-64 produces: gen_x86_64_shrd(int): xorl%eax, %eax ret ok(int): movl$1, %eax ret ix86_split_ashr(int): testl %edi, %edi movl$ok(int), %eax movl$gen_x86_64_shrd(int), %edx cmove %rdx, %rax xorl%edi, %edi jmp *%rax FWIW clang trunk also does not optimize this, yielding: ix86_split_ashr(int): # @ix86_split_ashr(int) testl %edi, %edi movl$gen_x86_64_shrd(int), %eax movl$ok(int), %ecx cmoveq %rax, %rcx xorl%edi, %edi jmpq*%rcx # TAILCALL ok(int):# @ok(int) movl$1, %eax retq gen_x86_64_shrd(int): # @gen_x86_64_shrd(int) xorl%eax, %eax retq ICC 19.0.1 _does_ optimize, resulting in: ix86_split_ashr(int): ret #24.1 _INTERNALf242c0c5::gen_x86_64_shrd(int): xorl %eax, %eax#6.10 ret #6.10 _INTERNALf242c0c5::ok(int): movl $1, %eax #12.10 ret #12.10
[Bug c/28306] const / pure call with ignored argument emitted.
--- Comment #3 from rguenth at gcc dot gnu dot org 2008-01-13 18:22 --- This works for 'const' functions because they stick on the function type as well. The attributes are only on the DECL and do not get merged and transfered to the resulting function type of the COND_EXPR. So this again asks for streamlining attributes on types vs. decls. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added CC||rguenth at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28306
[Bug c/28306] const / pure call with ignored argument emitted.
--- Comment #2 from rguenth at gcc dot gnu dot org 2006-07-07 17:30 --- Confirmed. -- rguenth at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2006-07-07 17:30:13 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28306
[Bug c/28306] const / pure call with ignored argument emitted.
--- Comment #1 from amylaar at gcc dot gnu dot org 2006-07-07 16:54 --- Created an attachment (id=11850) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11850&action=view) test case The available source code for the functions allows the compiler to see that the called functions are const. This should be sufficient for the compiler to figure out the call is not needed. Likewise, the pure attributes should also be sufficient to figure this out. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28306