Skip to content

Commit

Permalink
[silgen] Clean up RValue::isPlus{One,Zero}().
Browse files Browse the repository at this point in the history
  • Loading branch information
gottesmm committed Jul 26, 2017
1 parent a701b59 commit f043996
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/SILGen/RValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,19 +787,18 @@ void RValue::verifyConsistentOwnership() const {
}

bool RValue::isPlusOne(SILGenFunction &SGF) const & {
return llvm::none_of(values, [&SGF](ManagedValue mv) -> bool {
return llvm::all_of(values, [&SGF](ManagedValue mv) -> bool {
// Ignore trivial values and objects with trivial value ownership kind.
if (mv.getType().isTrivial(SGF.F.getModule()) ||
mv.getOwnershipKind() == ValueOwnershipKind::Trivial)
return false;
return !mv.hasCleanup();
(mv.getType().isObject() &&
mv.getOwnershipKind() == ValueOwnershipKind::Trivial))
return true;
return mv.hasCleanup();
});
}

bool RValue::isPlusZero(SILGenFunction &SGF) const & {
return llvm::none_of(values, [&SGF](ManagedValue mv) -> bool {
if (mv.getType().isTrivial(SGF.F.getModule()) ||
mv.getOwnershipKind() == ValueOwnershipKind::Trivial)
return false;
return mv.hasCleanup();
});
}

0 comments on commit f043996

Please sign in to comment.