[PATCH] D24759: [RFC][StaticAnalyser] fix unreachable code false positives when block numbers mismatch

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 23 07:22:03 PDT 2016

dcoughlin requested changes to this revision.
dcoughlin added a reviewer: dcoughlin.
This revision now requires changes to proceed.

Comment at: lib/Analysis/CFG.cpp:2986
@@ -2985,3 +2985,1 @@
-    if (!KnownVal.isFalse()) {
-      // Add an intermediate block between the BodyBlock and the
You need to keep this check so that the optimized CFG still removes edges that are trivially known to be false.

Comment at: lib/Analysis/CFG.cpp:2994
@@ -2993,3 @@
-      Succ = BodyBlock;
-      CFGBlock *LoopBackBlock = createBlock();
-      LoopBackBlock->setLoopTarget(D);
To keep the unoptimized and optimized blocks in sync, this block creation needs to be done regardless of whether the branch condition is known to be false. My advice would be to hoist the creation (and the FIXME comments)  to above the check for whether KnownVal is false.


More information about the cfe-commits mailing list