-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Add regression tests from ConstantData uselist removal #138960
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
Merged
arsenm
merged 1 commit into
main
from
users/arsenm/add-constantdata-uselist-regression-tests
May 8, 2025
Merged
Add regression tests from ConstantData uselist removal #138960
arsenm
merged 1 commit into
main
from
users/arsenm/add-constantdata-uselist-regression-tests
May 8, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced May 7, 2025
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-llvm-ir Author: Matt Arsenault (arsenm) ChangesAdd some examples of failures after 87f312a Full diff: https://github.com/llvm/llvm-project/pull/138960.diff 2 Files Affected:
diff --git a/llvm/test/CodeGen/X86/codegen-no-uselist-constantdata.ll b/llvm/test/CodeGen/X86/codegen-no-uselist-constantdata.ll
new file mode 100644
index 0000000000000..fef2c18b30a82
--- /dev/null
+++ b/llvm/test/CodeGen/X86/codegen-no-uselist-constantdata.ll
@@ -0,0 +1,52 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+
+; Make sure codegen doesn't try to inspect the use list of constants
+
+; Make sure we do not try to make use of the uselist of a constant
+; null when looking for the alignment of the pointer.
+define <2 x i32> @no_uselist_null_isDereferenceableAndAlignedPointer(i1 %arg0, ptr align(4) %arg) {
+; CHECK-LABEL: no_uselist_null_isDereferenceableAndAlignedPointer:
+; CHECK: # %bb.0:
+; CHECK-NEXT: xorl %eax, %eax
+; CHECK-NEXT: testb $1, %dil
+; CHECK-NEXT: cmoveq %rsi, %rax
+; CHECK-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; CHECK-NEXT: retq
+ %select.ptr = select i1 %arg0, ptr null, ptr %arg
+ %load = load i32, ptr %select.ptr
+ %insert = insertelement <2 x i32> zeroinitializer, i32 %load, i64 0
+ ret <2 x i32> %insert
+}
+
+; Make sure we do not try to inspect the uselist of a constant null
+; when processing a memcpy
+define void @gep_nullptr_no_inspect_uselist(ptr %arg) {
+; CHECK-LABEL: gep_nullptr_no_inspect_uselist:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movzbl 16, %eax
+; CHECK-NEXT: movb %al, (%rdi)
+; CHECK-NEXT: retq
+ %null_gep = getelementptr i8, ptr null, i64 16
+ call void @llvm.memcpy.p0.p0.i64(ptr %arg, ptr %null_gep, i64 1, i1 false)
+ ret void
+}
+
+define <16 x i8> @load_null_offset() {
+; CHECK-LABEL: load_null_offset:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movzbl 11, %eax
+; CHECK-NEXT: movd %eax, %xmm1
+; CHECK-NEXT: pslld $8, %xmm1
+; CHECK-NEXT: xorps %xmm0, %xmm0
+; CHECK-NEXT: movss {{.*#+}} xmm0 = xmm1[0],xmm0[1,2,3]
+; CHECK-NEXT: retq
+ %gep.null = getelementptr i8, ptr null, i64 11
+ %load = load i8, ptr %gep.null, align 1
+ %insert = insertelement <16 x i8> zeroinitializer, i8 %load, i64 1
+ ret <16 x i8> %insert
+}
+
+declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #0
+
+attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/no-uselist-constantdata-regression.ll b/llvm/test/Transforms/CorrelatedValuePropagation/no-uselist-constantdata-regression.ll
new file mode 100644
index 0000000000000..51be78788c454
--- /dev/null
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/no-uselist-constantdata-regression.ll
@@ -0,0 +1,30 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -passes=correlated-propagation < %s | FileCheck %s
+
+; Test for regression after 87f312aad6e from trying to use the uselist of constantdata
+
+define ptr @_ZN4mlir6Region15getParentOfTypeINS_19FunctionOpInterfaceEEET_v() {
+; CHECK-LABEL: define ptr @_ZN4mlir6Region15getParentOfTypeINS_19FunctionOpInterfaceEEET_v() {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[CALL_FCA_0_EXTRACT:%.*]] = extractvalue [2 x i64] zeroinitializer, 0
+; CHECK-NEXT: [[I2P:%.*]] = inttoptr i64 [[CALL_FCA_0_EXTRACT]] to ptr
+; CHECK-NEXT: [[CMP_I:%.*]] = icmp ne ptr [[I2P]], null
+; CHECK-NEXT: br i1 [[CMP_I]], label %[[CLEANUP:.*]], label %[[DO_COND:.*]]
+; CHECK: [[DO_COND]]:
+; CHECK-NEXT: br label %[[CLEANUP]]
+; CHECK: [[CLEANUP]]:
+; CHECK-NEXT: ret ptr [[I2P]]
+;
+entry:
+ %call.fca.0.extract = extractvalue [2 x i64] zeroinitializer, 0
+ %i2p = inttoptr i64 %call.fca.0.extract to ptr
+ %cmp.i = icmp ne ptr %i2p, null
+ br i1 %cmp.i, label %cleanup, label %do.cond
+
+do.cond: ; preds = %entry
+ br label %cleanup
+
+cleanup: ; preds = %do.cond, %entry
+ %phi = phi ptr [ %i2p, %entry ], [ null, %do.cond ]
+ ret ptr %phi
+}
|
nikic
approved these changes
May 7, 2025
Add some examples of failures after 87f312a
59ae795
to
516db0b
Compare
petrhosek
pushed a commit
to petrhosek/llvm-project
that referenced
this pull request
May 8, 2025
Add some examples of failures after 87f312a
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add some examples of failures after 87f312a