[openmp] [libcxx] [llvm] [clang] [libc] [lldb] [flang] [mlir] Fix Logical expression used for merged conditional if in FlattenCFG pass (PR #72522)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 16 22:13:52 PST 2023


================
@@ -450,9 +450,9 @@ bool FlattenCFGOpt::MergeIfRegion(BasicBlock *BB, IRBuilder<> &Builder) {
     if (!CompareIfRegionBlock(IfTrue1, IfTrue2, SecondEntryBlock))
       return false;
   } else if (IfTrue1 == FirstEntryBlock) {
-    // The then-path is empty, so we must use "and" operation to combine the
+    // The else-path is empty, so we must use "or" operation to combine the
     // conditions.
-    CombineOp = BinaryOperator::And;
+    CombineOp = BinaryOperator::Or;
----------------
mahtohappy wrote:

Even I had my doubts about it, but the testcase this issue had seems to give correct results on executions(output) with the changes and from my understanding the changes are correct. I'm hoping the the original author or reviewer will take a look. From my side, I'll try to regenerate all the patterns in the testcase in c file and execute and see if they're giving correct output on execution.

https://github.com/llvm/llvm-project/pull/72522


More information about the cfe-commits mailing list