https://github.com/Rageking8 created https://github.com/llvm/llvm-project/pull/79701
Fixes #79686 >From 6d0591f238444674f327ca502a93ad72bdd46110 Mon Sep 17 00:00:00 2001 From: Rageking8 <106309953+rageki...@users.noreply.github.com> Date: Sun, 28 Jan 2024 02:06:39 +0800 Subject: [PATCH] Resolve redundant predicates --- clang/lib/Sema/SemaChecking.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 502b24bcdf8b42b..532c1073b48b747 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -17185,7 +17185,7 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> { // evaluates to true. bool EvalResult = false; bool EvalOK = Eval.evaluate(BO->getLHS(), EvalResult); - bool ShouldVisitRHS = !EvalOK || (EvalOK && !EvalResult); + bool ShouldVisitRHS = !EvalOK || !EvalResult; if (ShouldVisitRHS) { Region = RHSRegion; Visit(BO->getRHS()); @@ -17217,7 +17217,7 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> { // [...] the second operand is not evaluated if the first operand is false. bool EvalResult = false; bool EvalOK = Eval.evaluate(BO->getLHS(), EvalResult); - bool ShouldVisitRHS = !EvalOK || (EvalOK && EvalResult); + bool ShouldVisitRHS = !EvalOK || EvalResult; if (ShouldVisitRHS) { Region = RHSRegion; Visit(BO->getRHS()); @@ -17268,8 +17268,8 @@ class SequenceChecker : public ConstEvaluatedExprVisitor<SequenceChecker> { // evaluated. [...] bool EvalResult = false; bool EvalOK = Eval.evaluate(CO->getCond(), EvalResult); - bool ShouldVisitTrueExpr = !EvalOK || (EvalOK && EvalResult); - bool ShouldVisitFalseExpr = !EvalOK || (EvalOK && !EvalResult); + bool ShouldVisitTrueExpr = !EvalOK || EvalResult; + bool ShouldVisitFalseExpr = !EvalOK || !EvalResult; if (ShouldVisitTrueExpr) { Region = TrueRegion; Visit(CO->getTrueExpr()); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits