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

Akash Banerjee via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 02:45:31 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);
----------------
TIFitis wrote:

I had encountered and passively fixed this issue in #124746.

I think the better fix would be to raise the restoreIP call to just before or after the assert, basically immediately after entering CodeGenCB and get rid of the restoreIP calls inside the switch case.

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


More information about the llvm-commits mailing list