[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-17 Thread via cfe-commits
https://github.com/martinboehme edited https://github.com/llvm/llvm-project/pull/68923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-17 Thread via cfe-commits
@@ -53,19 +52,8 @@ static int blockIndexInPredecessor(const CFGBlock , return BlockPos - Pred.succ_begin(); } -static bool isLoopHead(const CFGBlock ) { - if (const auto *T = B.getTerminatorStmt()) -switch (T->getStmtClass()) { - case Stmt::WhileStmtClass: -

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand closed https://github.com/llvm/llvm-project/pull/68923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread Yitzhak Mandelbaum via cfe-commits
@@ -53,19 +52,8 @@ static int blockIndexInPredecessor(const CFGBlock , return BlockPos - Pred.succ_begin(); } -static bool isLoopHead(const CFGBlock ) { - if (const auto *T = B.getTerminatorStmt()) -switch (T->getStmtClass()) { - case Stmt::WhileStmtClass: -

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/68923 >From 83486a35e6d0e754dd99369fc546d04afedbe923 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Thu, 12 Oct 2023 19:35:54 + Subject: [PATCH 1/3] [clang][dataflow] Check for backedges directly (instead

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread Yitzhak Mandelbaum via cfe-commits
@@ -502,14 +490,15 @@ runTypeErasedDataflowAnalysis( PostVisitCFG) { PrettyStackTraceAnalysis CrashInfo(CFCtx, "runTypeErasedDataflowAnalysis"); - PostOrderCFGView POV(()); - ForwardDataflowWorklist Worklist(CFCtx.getCFG(), ); + const clang::CFG =

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread via cfe-commits
@@ -913,6 +913,34 @@ TEST_F(FlowConditionTest, WhileStmt) { }); } +TEST_F(FlowConditionTest, WhileStmtWithAssignmentInCondition) { + std::string Code = R"( +void target(bool Foo) { + // This test checks whether the analysis preserves the connection between +

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread via cfe-commits
@@ -913,6 +913,34 @@ TEST_F(FlowConditionTest, WhileStmt) { }); } +TEST_F(FlowConditionTest, WhileStmtWithAssignmentInCondition) { + std::string Code = R"( +void target(bool Foo) { + // This test checks whether the analysis preserves the connection between +

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread via cfe-commits
@@ -4099,6 +4099,20 @@ TEST(TransferTest, LoopDereferencingChangingRecordPointerConverges) { ASSERT_THAT_ERROR(checkDataflowWithNoopAnalysis(Code), llvm::Succeeded()); } +TEST(TransferTest, LoopWithDisjunctiveConditionConverges) { martinboehme wrote: Test

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread via cfe-commits
@@ -53,19 +52,8 @@ static int blockIndexInPredecessor(const CFGBlock , return BlockPos - Pred.succ_begin(); } -static bool isLoopHead(const CFGBlock ) { - if (const auto *T = B.getTerminatorStmt()) -switch (T->getStmtClass()) { - case Stmt::WhileStmtClass: -

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread via cfe-commits
@@ -913,6 +913,34 @@ TEST_F(FlowConditionTest, WhileStmt) { }); } +TEST_F(FlowConditionTest, WhileStmtWithAssignmentInCondition) { + std::string Code = R"( +void target(bool Foo) { + // This test checks whether the analysis preserves the connection between +

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread via cfe-commits
@@ -502,14 +490,15 @@ runTypeErasedDataflowAnalysis( PostVisitCFG) { PrettyStackTraceAnalysis CrashInfo(CFCtx, "runTypeErasedDataflowAnalysis"); - PostOrderCFGView POV(()); - ForwardDataflowWorklist Worklist(CFCtx.getCFG(), ); + const clang::CFG =

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread via cfe-commits
https://github.com/martinboehme edited https://github.com/llvm/llvm-project/pull/68923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-16 Thread via cfe-commits
https://github.com/martinboehme approved this pull request. LGTM with comments https://github.com/llvm/llvm-project/pull/68923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-12 Thread Yitzhak Mandelbaum via cfe-commits
ymand wrote: > Nice fix! So, it looks like our definition of "loop head" was wrong. Indeed. We didn't think of the way control-flow constructs *inside* the condition expression would be represented. Ironically (?), this is actually simpler and fixes another issue besides, which is nice. ;)

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-12 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/68923 >From 83486a35e6d0e754dd99369fc546d04afedbe923 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Thu, 12 Oct 2023 19:35:54 + Subject: [PATCH 1/2] [clang][dataflow] Check for backedges directly (instead

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-12 Thread Gábor Horváth via cfe-commits
https://github.com/Xazax-hun approved this pull request. Nice fix! So, it looks like our definition of "loop head" was wrong. https://github.com/llvm/llvm-project/pull/68923 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-12 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 50ece4cba949787241b5fbfc94be6cfdc66e90ee da8cacb47b8f80f7ecb1e86f98683be6c54b4e57 --

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-12 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand updated https://github.com/llvm/llvm-project/pull/68923 >From 83486a35e6d0e754dd99369fc546d04afedbe923 Mon Sep 17 00:00:00 2001 From: Yitzhak Mandelbaum Date: Thu, 12 Oct 2023 19:35:54 + Subject: [PATCH] [clang][dataflow] Check for backedges directly (instead of

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-12 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Yitzhak Mandelbaum (ymand) Changes Widen on backedge nodes, instead of nodes with a loop statement as terminator. This fixes #67834 and a precision loss from assignment in a loop condition. The commit contains tests for both of these

[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)

2023-10-12 Thread Yitzhak Mandelbaum via cfe-commits
https://github.com/ymand created https://github.com/llvm/llvm-project/pull/68923 Widen on backedge nodes, instead of nodes with a loop statement as terminator. This fixes #67834 and a precision loss from assignment in a loop condition. The commit contains tests for both of these issues. >From