[cfe-users] Fine Grained Optimization Control
Navid Rahimi via cfe-users
cfe-users at lists.llvm.org
Sat Mar 27 19:24:33 PDT 2021
tl;dr: I want to control which optimization and transformation can and will
run on my code. Does Clang/LLVM permit such an approach?
I am doing this with GCC. But at first, it seems for some reason GCC does
not allow optimizations to run unless I am passing -Ox flag (x>=1). The
approach I thought would work is using -O3 and disabling all the
optimizations one by one with -fno-XXX, then passing each optimization I
want with -fXXX. Even after doing that it seems GCC does take the flags
seriously. Sometimes it might consider the -fXXX flags, but sometimes it
I was investigating this issue more recently due to a project I am involved
in. I realized that there are two sets of optimizations and transformation
can happen in Clang/LLVM. Clang can do a few optimizations itself on AST
and then LLVM will run its own optimizations. Please correct me if I am
Here is a list of few questions I am trying to find an answer for:
1) I am looking for a list of optimizations that Clang might do. Where can
I find them?
2) I am looking for a list of optimizations that LLVM might do. Where can I
3) Is there any way to disable/enable specific Clang optimization?
4) Is there any way to disable/enable specific LLVM optimization?
5) Would LLVM/Clang respect specific optimization flags?
I appreciate immensely any help regarding these questions.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-users