Skip to content

Commit 3c7c4d4

Browse files
[SelectOptimize] Update Missing PSI Error Message, Add Test (#193034)
Update the error message to omit a period/start with a lowercase letter per the coding standards. Also add a test as suggested in post-commit feedback on #192871. --------- Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
1 parent a5c12ac commit 3c7c4d4

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

llvm/lib/CodeGen/SelectOptimize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ PreservedAnalyses SelectOptimizeImpl::run(Function &F,
370370
PSI = FAM.getResult<ModuleAnalysisManagerFunctionProxy>(F)
371371
.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
372372
if (!PSI)
373-
reportFatalUsageError("This pass requires the profile-summary module "
374-
"analysis to be available.");
373+
reportFatalUsageError("this pass requires the profile-summary module "
374+
"analysis to be available");
375375
BFI = &FAM.getResult<BlockFrequencyAnalysis>(F);
376376

377377
// When optimizing for size, selects are preferable over branches.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
; RUN: not opt -mtriple=x86_64-unknown-unknown -passes='select-optimize' -disable-output < %s 2>&1 | FileCheck %s
2+
3+
;; Check that if we try to run select-optimize without requiring PSI,
4+
;; we get an appropriate usage error rather than an assertion or crash.
5+
6+
; CHECK: LLVM ERROR: this pass requires the profile-summary module analysis to be available
7+
8+
define void @test() {
9+
ret void
10+
}

0 commit comments

Comments
 (0)