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

Sergio Afonso via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 03:44:56 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);
----------------
skatrak wrote:

I see that this is done based on whether `info.DevicePtrInfoMap` is empty at the moment for the other cases. Can that result in similar problems that perhaps are addressed by moving this call right before the `switch` or do we actually want to make it conditional in the other cases?

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


More information about the llvm-commits mailing list