[Bug c++/84436] [8/9 Regression] Missed optimization with switch on enum constants returning the same value

2019-01-08 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436

Martin Liška  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=88753

--- Comment #14 from Martin Liška  ---
Thanks, I found that libzip package fails since the same revision. I'll start
with that. I create new PR for that: PR88753.

[Bug c++/84436] [8/9 Regression] Missed optimization with switch on enum constants returning the same value

2019-01-07 Thread romain.geissler at amadeus dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436

--- Comment #13 from Romain Geissler  ---
Apparently the clang-tlbgen failures started with r265241. Checking if it still
happens on gcc trunk with r265463 reverted.

[Bug c++/84436] [8/9 Regression] Missed optimization with switch on enum constants returning the same value

2019-01-07 Thread romain.geissler at amadeus dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436

--- Comment #12 from Romain Geissler  ---
Hi,

I have tried the following script directly inside docker using the official
"debian:buster" docker image, so I hope it will not require much more
dependencies than what is written here.

Tested with x86-64.



[Bug c++/84436] [8/9 Regression] Missed optimization with switch on enum constants returning the same value

2019-01-06 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436

--- Comment #11 from Martin Liška  ---
(In reply to Romain Geissler from comment #10)
> Hi,
> 
> FYI, I bisected this revision r265463 to introduce a regression when
> building the llvm toolchain.
> 
> If you do the following:
>  - build gcc 9 >= r265463 (including recent revisions from late December)
>  - build clang 7 or clang 8 svn with this gcc 9 (it will work)
>  - finally with the resulting clang, build llvm's compiler-rt
> 
> then clang itself will ICE. Before r265463 it was not the case, and
> considering the nature of the fix (missed optimization) I suspect more a gcc
> bug rather than a clang one.
> 
> The exact clang failure is:
> FAILED: CMakeFiles/clang_rt.builtins-x86_64.dir/divtc3.c.o 
> /workdir/build/final-system/llvm-build/./bin/clang
> --target=x86_64-1a-linux-gnu -DVISIBILITY_HIDDEN  -O2 -mmmx -msse -msse2
> -msse3
> -I/workdir/build/final-system/llvm-temporary-static-dependencies/install/
> include
> -I/workdir/build/final-system/llvm-temporary-static-dependencies/install/
> include/ncursesw -O3 -DNDEBUG-m64 -std=c11 -fPIC -fno-builtin
> -fvisibility=hidden -fomit-frame-pointer -MD -MT
> CMakeFiles/clang_rt.builtins-x86_64.dir/divtc3.c.o -MF
> CMakeFiles/clang_rt.builtins-x86_64.dir/divtc3.c.o.d -o
> CMakeFiles/clang_rt.builtins-x86_64.dir/divtc3.c.o   -c
> /workdir/src/llvm-8.0.0/compiler-rt/lib/builtins/divtc3.c
> fatal error: error in backend: Cannot select: 0x1a4b558: ch = fsqrt
> 0x199e868, 0x1a46e38, FrameIndex:i64<0>
>   0x1a46e38: f80,ch = CopyFromReg 0x199e868, Register:f80 %0
> 0x1a46d68: f80 = Register %0
>   0x1a4bd10: i64 = FrameIndex<0>
> In function: __divtc3
> clang-8: error: clang frontend command failed with exit code 70 (use -v to
> see invocation)
> clang version 8.0.0 
> Target: x86_64-1a-linux-gnu
> Thread model: posix
> InstalledDir: /workdir/build/final-system/llvm-build/./bin
> clang-8: note: diagnostic msg: PLEASE submit a bug report to
> https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
> and associated run script.
> clang-8: note: diagnostic msg: 
> 
> 
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
> clang-8: note: diagnostic msg: /tmp/divtc3-106b93.c
> clang-8: note: diagnostic msg: /tmp/divtc3-106b93.sh
> clang-8: note: diagnostic msg: 
> 
> Note: step 2 and 3 (build clang then build compiler-rt with the resulting
> clang) is done automatically when bootstrapping a 2-stage PGO clang using
> this cmake configuration:
> https://github.com/llvm-mirror/clang/blob/master/cmake/caches/PGO.cmake
> 
> I don't know how to help more in investigating this regression. If I can do
> something, please ask.
> 
> Cheers,
> Romain

Thank you for the report. Can you please provide exact steps how to build the
llvm/clang?

[Bug c++/84436] [8/9 Regression] Missed optimization with switch on enum constants returning the same value

2019-01-06 Thread romain.geissler at amadeus dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436

Romain Geissler  changed:

   What|Removed |Added

 CC||romain.geissler at amadeus dot 
com

--- Comment #10 from Romain Geissler  ---
Hi,

FYI, I bisected this revision r265463 to introduce a regression when building
the llvm toolchain.

If you do the following:
 - build gcc 9 >= r265463 (including recent revisions from late December)
 - build clang 7 or clang 8 svn with this gcc 9 (it will work)
 - finally with the resulting clang, build llvm's compiler-rt

then clang itself will ICE. Before r265463 it was not the case, and considering
the nature of the fix (missed optimization) I suspect more a gcc bug rather
than a clang one.

The exact clang failure is:
FAILED: CMakeFiles/clang_rt.builtins-x86_64.dir/divtc3.c.o 
/workdir/build/final-system/llvm-build/./bin/clang --target=x86_64-1a-linux-gnu
-DVISIBILITY_HIDDEN  -O2 -mmmx -msse -msse2 -msse3
-I/workdir/build/final-system/llvm-temporary-static-dependencies/install/include
-I/workdir/build/final-system/llvm-temporary-static-dependencies/install/include/ncursesw
-O3 -DNDEBUG-m64 -std=c11 -fPIC -fno-builtin -fvisibility=hidden
-fomit-frame-pointer -MD -MT CMakeFiles/clang_rt.builtins-x86_64.dir/divtc3.c.o
-MF CMakeFiles/clang_rt.builtins-x86_64.dir/divtc3.c.o.d -o
CMakeFiles/clang_rt.builtins-x86_64.dir/divtc3.c.o   -c
/workdir/src/llvm-8.0.0/compiler-rt/lib/builtins/divtc3.c
fatal error: error in backend: Cannot select: 0x1a4b558: ch = fsqrt 0x199e868,
0x1a46e38, FrameIndex:i64<0>
  0x1a46e38: f80,ch = CopyFromReg 0x199e868, Register:f80 %0
0x1a46d68: f80 = Register %0
  0x1a4bd10: i64 = FrameIndex<0>
In function: __divtc3
clang-8: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 8.0.0 
Target: x86_64-1a-linux-gnu
Thread model: posix
InstalledDir: /workdir/build/final-system/llvm-build/./bin
clang-8: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-8: note: diagnostic msg: 


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-8: note: diagnostic msg: /tmp/divtc3-106b93.c
clang-8: note: diagnostic msg: /tmp/divtc3-106b93.sh
clang-8: note: diagnostic msg: 

Note: step 2 and 3 (build clang then build compiler-rt with the resulting
clang) is done automatically when bootstrapping a 2-stage PGO clang using this
cmake configuration:
https://github.com/llvm-mirror/clang/blob/master/cmake/caches/PGO.cmake

I don't know how to help more in investigating this regression. If I can do
something, please ask.

Cheers,
Romain

[Bug c++/84436] [8/9 Regression] Missed optimization with switch on enum constants returning the same value

2018-10-24 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436

Martin Liška  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Martin Liška  ---
Implemented.

[Bug c++/84436] [8/9 Regression] Missed optimization with switch on enum constants returning the same value

2018-10-24 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436

--- Comment #8 from Martin Liška  ---
Author: marxin
Date: Wed Oct 24 13:52:21 2018
New Revision: 265463

URL: https://gcc.gnu.org/viewcvs?rev=265463=gcc=rev
Log:
Switch conversion: support any ax + b transformation (PR
tree-optimization/84436).

2018-10-24  Martin Liska  

PR tree-optimization/84436
* tree-switch-conversion.c (switch_conversion::contains_same_values_p):
Remove.
(switch_conversion::contains_linear_function_p): New.
(switch_conversion::build_one_array): Support linear
transformation on input.
* tree-switch-conversion.h (struct switch_conversion): Add
contains_linear_function_p declaration.
2018-10-24  Martin Liska  

PR tree-optimization/84436
* gcc.dg/tree-ssa/pr84436-1.c: New test.
* gcc.dg/tree-ssa/pr84436-2.c: New test.
* gcc.dg/tree-ssa/pr84436-3.c: New test.
* gcc.dg/tree-ssa/pr84436-4.c: New test.
* gcc.dg/tree-ssa/pr84436-5.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr84436-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr84436-2.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr84436-3.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr84436-4.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr84436-5.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-switch-conversion.c
trunk/gcc/tree-switch-conversion.h

[Bug c++/84436] [8/9 Regression] Missed optimization with switch on enum constants returning the same value

2018-09-25 Thread amonakov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436

Alexander Monakov  changed:

   What|Removed |Added

Summary|Missed optimization with|[8/9 Regression] Missed
   |switch on enum constants|optimization with switch on
   |returning the same value|enum constants returning
   ||the same value

--- Comment #7 from Alexander Monakov  ---
The above dup was marked as regression - adjusting bug title.