Skip to content

AMDGPU: Fix broken negative test from ancient times #131106

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
merged 1 commit into from
Mar 13, 2025

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Mar 13, 2025

Before the dawn of civilization, instructions were printed in all
caps using the raw tablegen pseudo-names. This -NOT check was looking
for that, instead of the actual ISA output. Just switch to using generated
checks. Also replace a use of undef.

Copy link
Contributor Author

arsenm commented Mar 13, 2025

@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

Before the dawn of civilization, instructions were printed in all
caps using the raw tablegen pseudo-names. This -NOT check was looking
for that, instead of the actual ISA output. Just switch to using generated
checks. Also replace a use of undef.


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

1 Files Affected:

  • (modified) llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll (+14-4)
diff --git a/llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll b/llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll
index 9ce0235fdcb18..d616fecfdc1ff 100644
--- a/llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll
+++ b/llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll
@@ -1,12 +1,22 @@
-; RUN: llc -mtriple=amdgcn -verify-machineinstrs %s -o - | 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 -o - | FileCheck %s
 
-; CHECK-LABEL: foo
-; CHECK-NOT: BUFFER_LOAD_DWORDX2_OFFSET
 ; After dead code elimination, that buffer load should be eliminated finally
 ; after dead lane detection.
 define amdgpu_kernel void @foo() {
+; CHECK-LABEL: foo:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    s_cbranch_execnz .LBB0_2
+; CHECK-NEXT:  ; %bb.1: ; %LeafBlock1
+; CHECK-NEXT:  .LBB0_2: ; %foo.exit
+; CHECK-NEXT:    s_mov_b32 s3, 0xf000
+; CHECK-NEXT:    s_mov_b32 s2, -1
+; CHECK-NEXT:    v_mov_b32_e32 v0, 0
+; CHECK-NEXT:    buffer_store_dword v0, off, s[0:3], 0
+; CHECK-NEXT:    s_endpgm
+; CHECK-NEXT:  ; %bb.3: ; %sw.bb10
 entry:
-  switch i8 undef, label %foo.exit [
+  switch i8 poison, label %foo.exit [
     i8 4, label %sw.bb4
     i8 10, label %sw.bb10
   ]

@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2025

@llvm/pr-subscribers-llvm-globalisel

Author: Matt Arsenault (arsenm)

Changes

Before the dawn of civilization, instructions were printed in all
caps using the raw tablegen pseudo-names. This -NOT check was looking
for that, instead of the actual ISA output. Just switch to using generated
checks. Also replace a use of undef.


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

1 Files Affected:

  • (modified) llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll (+14-4)
diff --git a/llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll b/llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll
index 9ce0235fdcb18..d616fecfdc1ff 100644
--- a/llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll
+++ b/llvm/test/CodeGen/AMDGPU/dead-machine-elim-after-dead-lane.ll
@@ -1,12 +1,22 @@
-; RUN: llc -mtriple=amdgcn -verify-machineinstrs %s -o - | 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 -o - | FileCheck %s
 
-; CHECK-LABEL: foo
-; CHECK-NOT: BUFFER_LOAD_DWORDX2_OFFSET
 ; After dead code elimination, that buffer load should be eliminated finally
 ; after dead lane detection.
 define amdgpu_kernel void @foo() {
+; CHECK-LABEL: foo:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    s_cbranch_execnz .LBB0_2
+; CHECK-NEXT:  ; %bb.1: ; %LeafBlock1
+; CHECK-NEXT:  .LBB0_2: ; %foo.exit
+; CHECK-NEXT:    s_mov_b32 s3, 0xf000
+; CHECK-NEXT:    s_mov_b32 s2, -1
+; CHECK-NEXT:    v_mov_b32_e32 v0, 0
+; CHECK-NEXT:    buffer_store_dword v0, off, s[0:3], 0
+; CHECK-NEXT:    s_endpgm
+; CHECK-NEXT:  ; %bb.3: ; %sw.bb10
 entry:
-  switch i8 undef, label %foo.exit [
+  switch i8 poison, label %foo.exit [
     i8 4, label %sw.bb4
     i8 10, label %sw.bb10
   ]

@arsenm arsenm force-pushed the users/arsenm/amdgpu/tests-replace-some-i32-undef-with-poison branch from 88ec6e4 to bebdc38 Compare March 13, 2025 11:55
@arsenm arsenm force-pushed the users/arsenm/amdgpu/fix-broken-negative-test branch from da8190e to d96b1df Compare March 13, 2025 11:59
entry:
switch i8 undef, label %foo.exit [
switch i8 poison, label %foo.exit [
Copy link
Contributor

Choose a reason for hiding this comment

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

In one of the prev. PR github actions suggested following:

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The bot is very overzealous and has no contextual understanding. This test needs to preserve the codegen output as exactly as possible, regardless of how well defined the program is

@arsenm arsenm force-pushed the users/arsenm/amdgpu/tests-replace-some-i32-undef-with-poison branch from bebdc38 to 0045ccb Compare March 13, 2025 13:08
Base automatically changed from users/arsenm/amdgpu/tests-replace-some-i32-undef-with-poison to main March 13, 2025 13:10
Before the dawn of civilization, instructions were printed in all
caps using the raw tablegen pseudo-names. This -NOT check was looking
for that, instead of the actual ISA output. Just switch to using generated
checks. Also replace a use of undef.
@arsenm arsenm force-pushed the users/arsenm/amdgpu/fix-broken-negative-test branch from d96b1df to 05c747f Compare March 13, 2025 13:15
Copy link
Contributor Author

arsenm commented Mar 13, 2025

Merge activity

  • Mar 13, 10:39 AM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Mar 13, 10:40 AM EDT: A user merged this pull request with Graphite.

@arsenm arsenm merged commit e3c80d4 into main Mar 13, 2025
9 of 10 checks passed
@arsenm arsenm deleted the users/arsenm/amdgpu/fix-broken-negative-test branch March 13, 2025 14:40
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.

4 participants