Skip to content

Conversation

@mariusz-sikora-at-amd
Copy link
Contributor

This patch is fixing assertions in downstream tests

This patch is fixing assertions in downstream tests
@llvmbot
Copy link
Member

llvmbot commented May 27, 2025

@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-llvm-transforms

Author: Mariusz Sikora (mariusz-sikora-at-amd)

Changes

This patch is fixing assertions in downstream tests


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/Scalar/NewGVN.cpp (+6-5)
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index 85bd8ef1f09a8..584cb0e89ef66 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -1530,11 +1530,12 @@ NewGVN::performSymbolicLoadCoercion(Type *LoadType, Value *LoadPtr,
   }
 
   if (auto *II = dyn_cast<IntrinsicInst>(DepInst)) {
-    auto *LifetimePtr = II->getOperand(1);
-    if (II->getIntrinsicID() == Intrinsic::lifetime_start &&
-        (LoadPtr == lookupOperandLeader(LifetimePtr) ||
-         AA->isMustAlias(LoadPtr, LifetimePtr)))
-      return createConstantExpression(UndefValue::get(LoadType));
+    if (II->getIntrinsicID() == Intrinsic::lifetime_start) {
+      auto *LifetimePtr = II->getOperand(1);
+      if (LoadPtr == lookupOperandLeader(LifetimePtr) ||
+          AA->isMustAlias(LoadPtr, LifetimePtr))
+        return createConstantExpression(UndefValue::get(LoadType));
+    }
   }
 
   // All of the below are only true if the loaded pointer is produced

Copy link
Collaborator

@dstutt dstutt left a comment

Choose a reason for hiding this comment

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

Yes, LGTM

Copy link
Contributor

@ManuelJBrito ManuelJBrito 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!

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

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

This patch is fixing assertions in downstream tests

Would it be possible to add the test?

@mariusz-sikora-at-amd
Copy link
Contributor Author

This patch is fixing assertions in downstream tests

Would it be possible to add the test?

Yes, I will try to prepare a small test in a moment.

@kmitropoulou
Copy link
Contributor

LGTM

@mariusz-sikora-at-amd mariusz-sikora-at-amd merged commit 33be70a into llvm:main May 30, 2025
11 checks passed
@mariusz-sikora-at-amd mariusz-sikora-at-amd deleted the pub-fix-lifetime-gvn branch May 30, 2025 05:58
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.

7 participants