Issue 156251
Summary _BitInt division with -Oz produces much larger code than -O0, and compiles slow
Labels new issue
Assignees
Reporter neldredge
    Using Clang 21.1.0 targeting x86_64-pc-linux-gnu and the following program:
```
typedef unsigned _BitInt(8192) T;

T div(T a, T b) {
    return a/b;
}
```
Using `-Oz` produces much larger code than with `-O0` (and also takes a long time to compile).
```
nate@tractrix /tmp $ time clang -c -Oz -std=c23 -target x86_64-pc-linux-gnu bitint.c 

real	0m13.015s
user	0m12.935s
sys	0m0.043s
nate@tractrix /tmp $ size bitint.o
   text	   data	    bss	    dec	    hex	filename
 975795	      0	      0	 975795	  ee3b3	bitint.o
nate@tractrix /tmp $ time clang -c -O0 -std=c23 -target x86_64-pc-linux-gnu bitint.c 

real	0m0.172s
user	0m0.143s
sys	0m0.027s
nate@tractrix /tmp $ size bitint.o
   text	   data	    bss	    dec	    hex	filename
 138973	 0	      0	 138973	  21edd	bitint.o
```
With `_BitInt(65536)`,`-Oz` didn't finish after 5 minutes, while every other level including `-Os` and `-O3` completed in about 20-30 seconds.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to