Skip to content

Conversation

@bhandarkar-pranav
Copy link
Contributor

This is a simple fix that ensures that the InsertPoint is properly fixed up after we have translated the dealloc region of all privatized variables during translation of omp.target from MLIR to LLVMIR.

Fix for #129202

… need cleaning up

This is a simple fix that ensures that the InsertPoint is properly fixed up
after we have translated the dealloc region of all privatized variables during
translation of omp.target from MLIR to LLVMIR.

Fix for llvm#129202
@llvmbot
Copy link
Member

llvmbot commented Feb 28, 2025

@llvm/pr-subscribers-mlir-openmp
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-llvm

@llvm/pr-subscribers-flang-openmp

Author: Pranav Bhandarkar (bhandarkar-pranav)

Changes

This is a simple fix that ensures that the InsertPoint is properly fixed up after we have translated the dealloc region of all privatized variables during translation of omp.target from MLIR to LLVMIR.

Fix for #129202


Full diff: https://github.com/llvm/llvm-project/pull/129205.diff

1 Files Affected:

  • (modified) mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp (+1)
diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index 5035551dd6023..32c7c501d03c3 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -4832,6 +4832,7 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
             "failed to inline `dealloc` region of `omp.private` "
             "op in the target region");
       }
+      return builder.saveIP();
     }
 
     return InsertPointTy(exitBlock.get(), exitBlock.get()->end());

Copy link
Member

@skatrak skatrak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, LGTM.

In fact, modify an existing test to check multi-block dealloc regions
@bhandarkar-pranav bhandarkar-pranav merged commit 273fca9 into llvm:main Feb 28, 2025
11 checks passed
@bhandarkar-pranav bhandarkar-pranav deleted the mlir/fix_129202 branch February 28, 2025 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants