-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[GVN] Handle empty attrs in Expression == #115761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-transforms Author: None (macurtis-amd) ChangesFull diff: https://github.com/llvm/llvm-project/pull/115761.diff 2 Files Affected:
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index e27f5a08c85a97..a3df7a0a39e6b2 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -156,7 +156,7 @@ struct llvm::GVNPass::Expression {
return false;
if (varargs != other.varargs)
return false;
- if (!attrs.isEmpty() && !other.attrs.isEmpty() &&
+ if ((!attrs.isEmpty() || !other.attrs.isEmpty()) &&
!attrs.intersectWith(type->getContext(), other.attrs).has_value())
return false;
return true;
diff --git a/llvm/test/Transforms/GVN/intersect-empty-attr.ll b/llvm/test/Transforms/GVN/intersect-empty-attr.ll
new file mode 100644
index 00000000000000..013b01c700ce4e
--- /dev/null
+++ b/llvm/test/Transforms/GVN/intersect-empty-attr.ll
@@ -0,0 +1,19 @@
+; RUN: opt -S -passes=gvn < %s | FileCheck %s
+
+declare i32 @bar() #0
+
+define i32 @foo() {
+entry:
+ %0 = tail call i32 @bar() #1
+ %1 = tail call i32 @bar()
+ ret i32 1
+}
+
+; CHECK-LABEL: define i32 @foo(
+; CHECK: %0 = tail call i32 @bar() #1
+; CHECK-NEXT: %1 = tail call i32 @bar()
+; CHECK-NEXT: ret i32 1
+; CHECK-NEXT: }
+
+attributes #0 = { memory(none) }
+attributes #1 = { "llvm.assume"="ompx_no_call_asm" }
|
Does it address the crash reported in #114545 (comment)? |
yes it does, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
Change-Id: I75e876452af701191d36331703654581c6eb46f2
565d70e
to
0f08b59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/183/builds/6156 Here is the relevant piece of the build log for the reference
|
relands: eea8b44 [GVN] Handle empty attrs in Expression == (llvm#115761) 984bca9 [GVN][NewGVN] Take call attributes into account in expressions (llvm#114545) Reverts: breaks comgr build 41e3919 [clang] Introduce diagnostics suppression mappings (llvm#112517) Change-Id: I3189bf1b5d66b980d2d711c3fe1d5fe217699bb1
No description provided.