[PATCH] D149640: [clang][dataflow] Change PruneTriviallyFalseEdges for building CFG

Martin Böhme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 3 04:08:45 PDT 2023


mboehme added inline comments.


================
Comment at: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp:2690
+        // `after_loop` is pruned by PruneTriviallyFalseEdges, so we only should
+        // have `in_loop`.
+        ASSERT_TRUE(Results.empty());
----------------
This comment looks stale?


================
Comment at: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp:2673
-
-        EXPECT_EQ(BarVal, FooPointeeVal);
       });
----------------
kinu wrote:
> mboehme wrote:
> > It's unfortuante that all of these checks have gone away. I think the test was actually trying to test something.
> > 
> > I'd suggest checking the environment at two different places:
> > 
> > ```
> >     void target(int *Foo) {
> >       do {
> >         int Bar = *Foo;
> >         // [[in_loop]]
> >       } while (true);
> >       (void)0;
> >       // [[after_loop]]
> >     }
> > ```
> > 
> > You can keep the existing checks for the `in_loop` environment and verify that `Results` doesn't actually contain an environment for `after_loop`.
> Wdyt if we change this to exercise `do { } while (false)` instead (with the checks that we already have), and add a simple while (true) {}?
Thanks, good idea!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149640/new/

https://reviews.llvm.org/D149640



More information about the cfe-commits mailing list