Skip to content

Commit d3cade9

Browse files
authored
Merge pull request #30534 from pi1024e/Optimizations
Remove redundant conditional check for true and false when the boolean is right there.
2 parents 24445dd + 647db46 commit d3cade9

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ bool Parser::parseSpecializeAttributeArguments(
644644
return false;
645645
}
646646
if (ParamLabel == "exported") {
647-
Exported = isTrue ? true : false;
647+
Exported = isTrue;
648648
}
649649
}
650650
if (ParamLabel == "kind") {

lib/SILOptimizer/Transforms/DeadStoreElimination.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ bool DSEContext::run() {
12011201
return false;
12021202

12031203
// Do we run a pessimistic data flow ?
1204-
bool Optimistic = Kind == ProcessKind::ProcessOptimistic ? true : false;
1204+
const bool Optimistic = (Kind == ProcessKind::ProcessOptimistic);
12051205

12061206
// For all basic blocks in the function, initialize a BB state.
12071207
//

lib/SILOptimizer/Transforms/RedundantLoadElimination.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,8 +1563,7 @@ bool RLEContext::run() {
15631563
return false;
15641564

15651565
// Do we run a multi-iteration data flow ?
1566-
bool Optimistic = Kind == ProcessKind::ProcessMultipleIterations ?
1567-
true : false;
1566+
const bool Optimistic = (Kind == ProcessKind::ProcessMultipleIterations);
15681567

15691568
// These are a list of basic blocks that we actually processed.
15701569
// We do not process unreachable block, instead we set their liveouts to nil.

lib/SILOptimizer/Utils/OptimizerStatsUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ bool isMatchingFunction(SILFunction *F, bool shouldHaveNamePattern = false) {
648648
return FuncName.contains(StatsOnlyFunctionsNamePattern);
649649
}
650650

651-
return shouldHaveNamePattern ? true : false;
651+
return shouldHaveNamePattern;
652652
}
653653

654654
/// Compute the delta between the old and new values.

0 commit comments

Comments
 (0)