[PATCH] D59514: [PGO] Profile guided code size optimization.
Easwaran Raman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 12:34:32 PDT 2019
eraman added inline comments.
================
Comment at: lib/Transforms/Utils/SizeOpts.cpp:23
+
+bool llvm::shouldOptimizeForSize(Function *F, ProfileSummaryInfo *PSI,
+ BlockFrequencyInfo *BFI) {
----------------
In a follow-up patch, it might be good to make this work for the non-profile case and call this whereever F->optForSize() is used.
================
Comment at: lib/Transforms/Utils/SizeOpts.cpp:27
+ assert(PSI);
+ assert(BFI);
+ return ProfileGuidedSizeOpt && PSI->isFunctionColdInCallGraph(F, *BFI);
----------------
Instead of the asserts, return false if any one of them is null. This will avoid doing if (PSI && BFI && shouldOptimizeForSize(...)) in the callers.
================
Comment at: test/Transforms/ConstantHoisting/ARM/const-addr-no-neg-offset.ll:49
+; PGSO-LABEL: @foo_pgso
+; PGSO-NOT: [[CONST2:%const_mat[0-9]*]] = add i32 %const, -4
+ %0 = load volatile i32, i32* inttoptr (i32 1073876992 to i32*), align 4096
----------------
Perhaps add a CHECK: [[CONST2:%const_mat[0-9]*]] = add i32 %const, -4 to check the size optimization doesn't happen when -pgso is not used?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59514/new/
https://reviews.llvm.org/D59514
More information about the llvm-commits
mailing list