[llvm-dev] clang optimizations
via llvm-dev
llvm-dev at lists.llvm.org
Mon Jan 25 04:12:44 PST 2021
Hi Florian,
Thank you for your quick response. This fixes the optimization.
Best regards,
Viorel
From: Florian Hahn <florian_hahn at apple.com>
Sent: Monday, January 25, 2021 1:58 PM
To: viorel.preoteasa at gmail.com; llvm-dev <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] clang optimizations
Hi,
On Jan 25, 2021, at 11:48, via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > wrote:
Hello,
I am trying to apply level 3 of optimizations to a simple program. If I run:
clang -S -O3 -emit-llvm test.cpp -o testo.ll
all seems OK, the result testo.ll is highly optimized.
However if I attempt the same using:
clang -S -emit-llvm test.cpp -o a.ll
opt-10 -S --O3 a.ll -o test.ll
Please take a look at the attributes added to the functions: https://godbolt.org/z/fs9f8n . Without optimizations (-O0), Clang will add `optnone` to the functions, effectively disabling optimizations when you run `opt`. If you don’t want clang to run optimizations, but not add `optnone`, you can use `clang -O3 -emit-llvm -S -mllvm -disable-llvm-optzns`.
Cheers,
Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210125/04d2c95e/attachment.html>
More information about the llvm-dev
mailing list