Page MenuHomePhabricator

[Driver] Pass -plugin-opt=O2 for -Os -Oz and -plugin-opt=O1 for -Og
ClosedPublic

Authored by MaskRay on May 13 2020, 5:52 PM.

Details

Summary

Fixes PR42445 (-Os -Oz translate to -plugin-opt=Os (Oz) which cannot be
recognized by LLVMgold.so or LLD).

The optimization level mapping matches
CompilerInvocation.cpp:getOptimizationLevel() and SpeedLevel of
PassBuilder::OptimizationLevel::O*.

-plugin-opt=O* affects the way we construct regular LTO/ThinLTO pass
manager pipeline.

Diff Detail

Unit TestsFailed

TimeTest
380 msClang.CodeGen::Unknown Unit Message ("")
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/lib/clang/11.0.0/include -nostdsysteminc -target-cpu z13 -triple s390x-linux-gnu -O -fzvector -flax-vector-conversions=none -ffp-exception-behavior=strict -Wall -Wno-unused -Werror -emit-llvm /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/builtins-systemz-zvector-constrained.c -o - | /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/builtins-systemz-zvector-constrained.c
2,009 msClang.CodeGen::Unknown Unit Message ("")
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/lib/clang/11.0.0/include -nostdsysteminc -target-cpu z13 -triple s390x-linux-gnu -O -fzvector -flax-vector-conversions=none -Wall -Wno-unused -Werror -emit-llvm /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/builtins-systemz-zvector.c -o - | /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/builtins-systemz-zvector.c
430 msClang.CodeGen::Unknown Unit Message ("")
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/lib/clang/11.0.0/include -nostdsysteminc -target-cpu z14 -triple s390x-linux-gnu -O -fzvector -flax-vector-conversions=none -ffp-exception-behavior=strict -Wall -Wno-unused -Werror -emit-llvm /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/builtins-systemz-zvector2-constrained.c -o - | /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/builtins-systemz-zvector2-constrained.c
520 msClang.CodeGen::Unknown Unit Message ("")
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/lib/clang/11.0.0/include -nostdsysteminc -target-cpu z14 -triple s390x-linux-gnu -O -fzvector -flax-vector-conversions=none -Wall -Wno-unused -Werror -emit-llvm /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/builtins-systemz-zvector2.c -o - | /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/builtins-systemz-zvector2.c
810 msClang.CodeGen::Unknown Unit Message ("")
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/clang -cc1 -internal-isystem /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/lib/clang/11.0.0/include -nostdsysteminc -ffreestanding /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/fma-builtins-constrained.c -triple=x86_64-unknown-linux-gnu -target-feature +fma -O -emit-llvm -o - | /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/build/bin/FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=UNCONSTRAINED /mnt/disks/ssd0/agent/workspace/BETA_amd64_debian_testing_clang8/llvm-project/clang/test/CodeGen/fma-builtins-constrained.c
View Full Test Results (10 Failed)

Event Timeline

MaskRay created this revision.May 13 2020, 5:52 PM

LGTM, probably want @pcc to approve as well.

pcc accepted this revision.May 14 2020, 10:13 AM

LGTM

clang/test/Driver/lto.c
52

I think this one should be --check-prefix=O2.

This revision is now accepted and ready to land.May 14 2020, 10:13 AM
MaskRay marked an inline comment as done.May 14 2020, 10:29 AM

Thanks for the review. Will remove D79916 as a parent and commit this one first.

clang/test/Driver/lto.c
52

I added D79916 as a parent:)

Looks like I should just land this patch first and probably update the test in D79916.

MaskRay updated this revision to Diff 264027.May 14 2020, 10:36 AM
MaskRay edited the summary of this revision. (Show Details)

-O => -O2 (temporarily, pending on the resolution of D79916)

Add a test for -Ofast

This revision was automatically updated to reflect the committed changes.

Great! Maybe worth to add a release note that -Os works with LTO?