[PATCH] D142047: [opt] Fix static code analysis concerns
Arvind Sudarsanam via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 19 10:06:42 PST 2023
asudarsa updated this revision to Diff 490573.
asudarsa edited the summary of this revision.
asudarsa added a comment.
Based on reviewer's comments, two more code-sites had this issue and have been fixed. Thanks
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142047/new/
https://reviews.llvm.org/D142047
Files:
llvm/tools/opt/NewPMDriver.cpp
Index: llvm/tools/opt/NewPMDriver.cpp
===================================================================
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -354,11 +354,15 @@
}
if (CSPGOKindFlag != NoCSPGO) {
if (P && (P->Action == PGOOptions::IRInstr ||
- P->Action == PGOOptions::SampleUse))
+ P->Action == PGOOptions::SampleUse)) {
errs() << "CSPGOKind cannot be used with IRInstr or SampleUse";
+ return false;
+ }
if (CSPGOKindFlag == CSInstrGen) {
- if (CSProfileGenFile.empty())
+ if (CSProfileGenFile.empty()) {
errs() << "CSInstrGen needs to specify CSProfileGenFile";
+ return false;
+ }
if (P) {
P->CSAction = PGOOptions::CSIRInstr;
P->CSProfileGenFile = CSProfileGenFile;
@@ -366,8 +370,10 @@
P = PGOOptions("", CSProfileGenFile, ProfileRemappingFile,
PGOOptions::NoAction, PGOOptions::CSIRInstr);
} else /* CSPGOKindFlag == CSInstrUse */ {
- if (!P)
+ if (!P) {
errs() << "CSInstrUse needs to be together with InstrUse";
+ return false;
+ }
P->CSAction = PGOOptions::CSIRUse;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142047.490573.patch
Type: text/x-patch
Size: 1213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230119/bb77c586/attachment.bin>
More information about the llvm-commits
mailing list