[llvm] [mlir] [Flang][MLIR][OpenMP] Fix Target Data if (present(...)) causing LLVM-IR branching error (PR #123771)

Jan Leyonberg via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 08:55:10 PST 2025


================
@@ -3727,6 +3727,9 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
       }
       break;
     case BodyGenTy::DupNoPriv:
+      // We must always restoreIP regardless of doing anything the caller
+      // does not restore it, leading to incorrect (no) branch generation.
+      builder.restoreIP(codeGenIP);
----------------
jsjodin wrote:

Setting and restoring the IPs and AllocalIPs is really complicated. It would be nice to have a better approach maybe generate code using regions.

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


More information about the llvm-commits mailing list