Skip to content

Commit

Permalink
Fix ElideAsyncCopies to not mess with types.
Browse files Browse the repository at this point in the history
I do not recall why there was a carveout for constants.
  • Loading branch information
benvanik committed Feb 26, 2025
1 parent ec2f5e8 commit 8ba9c20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ static bool isSafeToElideCloneOp(IREE::Stream::AsyncCloneOp cloneOp,
llvm::cast<IREE::Stream::ResourceType>(cloneOp.getSource().getType());
auto targetType =
llvm::cast<IREE::Stream::ResourceType>(cloneOp.getResult().getType());
if (sourceType != targetType &&
sourceType.getLifetime() == IREE::Stream::Lifetime::Constant) {
if (sourceType != targetType) {
LLVM_DEBUG(llvm::dbgs()
<< " - clone is a resource lifetime cast (" << sourceType
<< " to " << targetType << "); cannot elide\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ void buildStreamAsyncPassPipeline(OpPassManager &passManager,
// change and it makes the IR cleaner.
passManager.addPass(IREE::Stream::createRefineUsagePass());

// Cleanup any clones that are now redundant.
passManager.addPass(IREE::Stream::createElideAsyncCopiesPass());

buildStreamCleanupPassPipeline(passManager, transformOptions);

// Verify all stream.async.* op access ranges that we can by taking advantage
Expand Down

0 comments on commit 8ba9c20

Please sign in to comment.