[llvm-branch-commits] [clang] [llvm] [mlir] [OMPIRBuilder] CANCEL IF(FALSE) is still a cancellation point (PR #164587)

Michael Kruse via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 22 04:30:28 PDT 2025


================
@@ -1087,8 +1087,20 @@ OpenMPIRBuilder::createCancel(const LocationDescription &Loc,
   auto *UI = Builder.CreateUnreachable();
 
   Instruction *ThenTI = UI, *ElseTI = nullptr;
-  if (IfCondition)
+  if (IfCondition) {
     SplitBlockAndInsertIfThenElse(IfCondition, UI, &ThenTI, &ElseTI);
+
+    // Even if the if condition evaluates to false, this should count as a
+    // cancellation point
+    Builder.SetInsertPoint(ElseTI);
+    auto ElseIP = Builder.saveIP();
----------------
Meinersbur wrote:

[style] [Don’t “almost always” use auto](https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable)

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


More information about the llvm-branch-commits mailing list