Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,11 @@ class PrepareForOMPOffloadPrivatizationPass
// variable, rewrite all the uses of the original variable with
// the heap-allocated variable.
rewriter.setInsertionPoint(targetOp);
rewriter.setInsertionPoint(cloneModifyAndErase(mapInfoOp));
auto clonedOp = cast<omp::MapInfoOp>(cloneModifyAndErase(mapInfoOp));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just updating it:

Suggested change
auto clonedOp = cast<omp::MapInfoOp>(cloneModifyAndErase(mapInfoOp));
mapInfoOp = cast<omp::MapInfoOp>(cloneModifyAndErase(mapInfoOp));

That way no risk of misusing mapInfoOp anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, thanks! Done: 7fdd34a

rewriter.setInsertionPoint(clonedOp);

// Fix any members that may use varPtr to now use heapMem
for (auto member : mapInfoOp.getMembers()) {
for (auto member : clonedOp.getMembers()) {
auto memberMapInfoOp = cast<omp::MapInfoOp>(member.getDefiningOp());
if (!usesVarPtr(memberMapInfoOp))
continue;
Expand All @@ -275,7 +276,7 @@ class PrepareForOMPOffloadPrivatizationPass
// targetOp.
if (isPrivatizedByValue) {
rewriter.setInsertionPoint(targetOp);
auto newPrivVar = LLVM::LoadOp::create(rewriter, mapInfoOp.getLoc(),
auto newPrivVar = LLVM::LoadOp::create(rewriter, clonedOp.getLoc(),
varType, heapMem);
newPrivVars.push_back(newPrivVar);
}
Expand Down