This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][HIP] Improve opt-level handling
ClosedPublic

Authored by scott.linder on Dec 3 2019, 2:25 PM.

Details

Summary

The HIP toolchain invokes llc without an explicit opt-level, meaning
it always uses the default (-O2). This makes it impossible to use -O1,
for example. The HIP toolchain also coerces -Os/-Oz to -O2 even when
invoking opt, and it coerces -Og to -O2 rather than -O1.

Forward the opt-level to llc as well as opt, and only coerce levels
where it is required.

Diff Detail

Event Timeline

scott.linder created this revision.Dec 3 2019, 2:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 3 2019, 2:25 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
scott.linder retitled this revision from [HIP] Improve opt-level handling to [AMDGPU][HIP] Improve opt-level handling.Dec 3 2019, 2:27 PM
yaxunl accepted this revision.Dec 4 2019, 8:17 AM

LGTM

clang/lib/Driver/ToolChains/HIP.cpp
153

Please add /*IsLlc=*/ before true

This revision is now accepted and ready to land.Dec 4 2019, 8:17 AM

Update other toolchain tests I had missed, and address feedback.

yaxunl accepted this revision.Dec 5 2019, 7:43 AM
This revision was automatically updated to reflect the committed changes.