Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

turn off clang optimization, remove phi instruction

1) Is it possible to turn off any optimization in clang?

2) Is there a way to remove any phi instruction from generated llvm code?

I use clang with options: clang test.c -Wimplicit -emit-llvm -g -O0 -c -o result.bc

And for some source files clang emit llvm code with phi-instructions. I find any wat to get llvm-file without phi-instructions.

like image 349
Passenger Avatar asked Feb 23 '26 08:02

Passenger


1 Answers

You can use LLVM's reg2mem pass to get rid of any phi's. Just feed you .bc out of clang into opt -reg2mem and you're done

like image 99
Anton Korobeynikov Avatar answered Feb 26 '26 15:02

Anton Korobeynikov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!