This is an archive of the discontinued LLVM Phabricator instance.

[docs] Prevent O0 optnone for opt input
ClosedPublic

Authored by smeenai on Jan 18 2019, 5:09 PM.

Details

Summary

If we just compile with -O0, clang will add optnone attributes
everywhere, so opt won't actually be able to perform any passes.
Instruct clang to not emit the optnone so opt can do its thing.

Diff Detail

Repository
rL LLVM

Event Timeline

smeenai created this revision.Jan 18 2019, 5:09 PM
smeenai marked an inline comment as done.Jan 18 2019, 5:10 PM
smeenai added inline comments.
llvm/docs/HowToSubmitABug.rst
87 ↗(On Diff #182646)

This is definitely over 80 columns, but I'm not sure if we're strict about that in the documentation, and what the best way to split it would be.

Also, are there any preferences for -O0 -Xclang -disable-O0-optnone vs. -O1 -Xclang -disable-llvm-passes vs. -O1 -Xclang -disable-llvm-optzns?

craig.topper added inline comments.
llvm/docs/HowToSubmitABug.rst
87 ↗(On Diff #182646)

I think -disable-passes is preferred over -disable-llvm-optzns. That spelling is weird.

Using -O1 -Xclang -disable-llvm-passes is going to more accurately give the IR. There are other differences that clang makes in -O0 other than the obvious optnone.

smeenai updated this revision to Diff 182653.Jan 18 2019, 5:38 PM

@ctopper comment

smeenai marked an inline comment as done.Jan 18 2019, 5:38 PM
smeenai added inline comments.
llvm/docs/HowToSubmitABug.rst
87 ↗(On Diff #182646)

Just for my knowledge, could you elaborate on some of the differences, if you happen to remember them off-hand?

craig.topper added inline comments.Jan 18 2019, 5:51 PM
llvm/docs/HowToSubmitABug.rst
87 ↗(On Diff #182646)

I think TBAA metadata is skipped in -O0 as one example. You can grep for CodeGenOpts.OptimizationLevel in clang's lib/CodeGen/ directory for others.

Ping.

I might just commit for post-commit review, since @craig.topper weighed in on my main question above.

This revision is now accepted and ready to land.Jan 29 2019, 2:16 PM
This revision was automatically updated to reflect the committed changes.