Skip to content

Commit

Permalink
Merge pull request swiftlang#30534 from pi1024e/Optimizations
Browse files Browse the repository at this point in the history
Remove redundant conditional check for true and false when the boolean is right there.
  • Loading branch information
CodaFi authored Mar 21, 2020
2 parents 24445dd + 647db46 commit d3cade9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ bool Parser::parseSpecializeAttributeArguments(
return false;
}
if (ParamLabel == "exported") {
Exported = isTrue ? true : false;
Exported = isTrue;
}
}
if (ParamLabel == "kind") {
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Transforms/DeadStoreElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ bool DSEContext::run() {
return false;

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

// For all basic blocks in the function, initialize a BB state.
//
Expand Down
3 changes: 1 addition & 2 deletions lib/SILOptimizer/Transforms/RedundantLoadElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1563,8 +1563,7 @@ bool RLEContext::run() {
return false;

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

// These are a list of basic blocks that we actually processed.
// We do not process unreachable block, instead we set their liveouts to nil.
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Utils/OptimizerStatsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ bool isMatchingFunction(SILFunction *F, bool shouldHaveNamePattern = false) {
return FuncName.contains(StatsOnlyFunctionsNamePattern);
}

return shouldHaveNamePattern ? true : false;
return shouldHaveNamePattern;
}

/// Compute the delta between the old and new values.
Expand Down

0 comments on commit d3cade9

Please sign in to comment.