[PATCH] D78881: [FlattenCFG] Fix `MergeIfRegion` in case then-path is empty

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 06:56:49 PDT 2020


kuhar accepted this revision.
kuhar added a comment.
This revision is now accepted and ready to land.

I followed the new tests and the patch seems fine to me, but I'd rather someone else took a look too.



================
Comment at: llvm/lib/Transforms/Utils/FlattenCFG.cpp:487
   Builder.SetInsertPoint(PBI);
-  Value *NC = Builder.CreateOr(CInst1, CC);
-  PBI->replaceUsesOfWith(CC, NC);
+  if (Invert2) {
+    // If this is a "cmp" instruction, only used for branching (and nowhere
----------------
Is there a better name for `Invert2`? I think until this point it's difficult to tell what it's actually for.


================
Comment at: llvm/test/Transforms/Util/flattencfg.ll:32
 ; CHECK-NEXT:    %1 = fcmp ult float %b
-; CHECK-NEXT:    [[COND:%[a-z0-9]+]] = or i1 %0, %1
+; CHECK-NEXT:    [[COND:%[a-z0-9]+]] = and i1 %0, %1
 ; CHECK-NEXT:    br i1 [[COND]], label %bb4, label %bb3
----------------
Good catch!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78881





More information about the llvm-commits mailing list