[llvm] [FlattenCFG] Merge parallel conditions with logical and/or (PR #218441)

Advit Arora via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 06:39:52 PDT 2026


================
@@ -283,10 +284,13 @@ bool FlattenCFGOpt::FlattenParallelAndOr(BasicBlock *BB, IRBuilder<> &Builder) {
     Value *NC;
     if (Idx == 0)
       // Case 2, use parallel or.
-      NC = Builder.CreateOr(PC, CC);
+      NC = Builder.CreateLogicalOr(PC, CC);
     else
       // Case 1, use parallel and.
-      NC = Builder.CreateAnd(PC, CC);
+      NC = Builder.CreateLogicalAnd(PC, CC);
+
+    if (SelectInst *SI = dyn_cast<SelectInst>(NC))
+      setExplicitlyUnknownBranchWeightsIfProfiled(*SI, DEBUG_TYPE);
----------------
advitrocks9 wrote:

Right, fixed the description. The branch's !prof has the same problem and longer chains need the product carried through, so I'll do it in a follow-up.

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


More information about the llvm-commits mailing list