Skip to content

AMDGPU: Switch test to generated checks #131315

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

arsenm
Copy link
Contributor

@arsenm arsenm commented Mar 14, 2025

I doubt this is testing what it originally intended anymore. Also
replace an undef.

Copy link
Contributor Author

arsenm commented Mar 14, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented Mar 14, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

I doubt this is testing what it originally intended anymore. Also
replace an undef.


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

1 Files Affected:

  • (modified) llvm/test/CodeGen/AMDGPU/subreg-eliminate-dead.ll (+7-4)
diff --git a/llvm/test/CodeGen/AMDGPU/subreg-eliminate-dead.ll b/llvm/test/CodeGen/AMDGPU/subreg-eliminate-dead.ll
index 59ad6f6139ace..2efcb411cf0ee 100644
--- a/llvm/test/CodeGen/AMDGPU/subreg-eliminate-dead.ll
+++ b/llvm/test/CodeGen/AMDGPU/subreg-eliminate-dead.ll
@@ -1,16 +1,19 @@
-; RUN: llc -mtriple=amdgcn-- -verify-machineinstrs -o - %s | FileCheck %s
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc -mtriple=amdgcn-- -mcpu=tahiti < %s | FileCheck %s
 ; LiveRangeEdit::eliminateDeadDef did not update LiveInterval sub ranges
 ; properly.
 
 ; Just make sure this test doesn't crash.
-; CHECK-LABEL: foobar:
-; CHECK: s_endpgm
 define amdgpu_kernel void @foobar() {
+; CHECK-LABEL: foobar:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    s_endpgm
   %v0 = icmp eq <4 x i32> poison, <i32 0, i32 1, i32 2, i32 3>
   %v3 = sext <4 x i1> %v0 to <4 x i32>
   %v4 = extractelement <4 x i32> %v3, i32 1
   %v5 = icmp ne i32 %v4, 0
-  %v6 = select i1 %v5, i32 undef, i32 0
+  %undef = freeze i32 poison
+  %v6 = select i1 %v5, i32 %undef, i32 0
   %v15 = insertelement <2 x i32> poison, i32 %v6, i32 1
   store <2 x i32> %v15, ptr addrspace(1) poison, align 8
   ret void

Copy link

github-actions bot commented Mar 14, 2025

⚠️ undef deprecator found issues in your code. ⚠️

You can test this locally with the following command:
git diff -U0 --pickaxe-regex -S '([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)' 5679be1b12a79ce1c22d4f588de634ac64a5116b 7b23925faefc723e69bb5afc04a5b2c47fca178b llvm/test/CodeGen/AMDGPU/subreg-eliminate-dead.ll

The following files introduce new uses of undef:

  • llvm/test/CodeGen/AMDGPU/subreg-eliminate-dead.ll

Undef is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields undef. You should use poison values for placeholders instead.

In tests, avoid using undef and having tests that trigger undefined behavior. If you need an operand with some unimportant value, you can add a new argument to the function and use that instead.

For example, this is considered a bad practice:

define void @fn() {
  ...
  br i1 undef, ...
}

Please use the following instead:

define void @fn(i1 %cond) {
  ...
  br i1 %cond, ...
}

Please refer to the Undefined Behavior Manual for more information.

@arsenm arsenm force-pushed the users/arsenm/amdgpu/switch-subreg-eliminate-dead-to-generated-checks branch from 22bcd30 to 1b2648a Compare March 14, 2025 13:27
@arsenm arsenm force-pushed the users/arsenm/amdgpu/migrate-more-tests-from-undef branch 2 times, most recently from 094daa9 to 5679be1 Compare March 14, 2025 17:30
@arsenm arsenm force-pushed the users/arsenm/amdgpu/switch-subreg-eliminate-dead-to-generated-checks branch from 1b2648a to 7b23925 Compare March 14, 2025 17:31
Copy link
Contributor Author

arsenm commented Mar 17, 2025

Merge activity

  • Mar 17, 4:47 AM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Mar 17, 4:58 AM EDT: Graphite rebased this pull request as part of a merge.
  • Mar 17, 5:01 AM EDT: Graphite rebased this pull request as part of a merge.
  • Mar 17, 5:03 AM EDT: A user merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/amdgpu/migrate-more-tests-from-undef branch 3 times, most recently from d7aacda to fcd1a3b Compare March 17, 2025 08:54
Base automatically changed from users/arsenm/amdgpu/migrate-more-tests-from-undef to main March 17, 2025 08:57
@arsenm arsenm force-pushed the users/arsenm/amdgpu/switch-subreg-eliminate-dead-to-generated-checks branch from 7b23925 to 9bace50 Compare March 17, 2025 08:58
I doubt this is testing what it originally intended anymore. Also
replace an undef.
@arsenm arsenm force-pushed the users/arsenm/amdgpu/switch-subreg-eliminate-dead-to-generated-checks branch from 9bace50 to 9941983 Compare March 17, 2025 09:00
@arsenm arsenm merged commit ee8a804 into main Mar 17, 2025
5 of 9 checks passed
@arsenm arsenm deleted the users/arsenm/amdgpu/switch-subreg-eliminate-dead-to-generated-checks branch March 17, 2025 09:03
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.

3 participants