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

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 08:36:36 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);
----------------
agozillon wrote:

It doesn't from what I can tell with testing and actually causes runtime errors as opposed to compile time errors! :-) I believe it likely comes from the fact that the lambda is called in a different manner by the OMPIRBuilder based on a variable amount of conditions, so I'd be loathe to change it further without good reason/a reproducer. 

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


More information about the llvm-commits mailing list