[llvm] [AMDGPU][GlobalISel] Implement missing rules for G_TRUNC legalization (PR #180647)
Petar Avramovic via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 05:11:24 PDT 2026
petar-avramovic wrote:
> I tried a few different filter regexes, including "COPY" and "LOAD". An issue is that it does not realize missing definitions.
I was trying this out, it is kind of difficult to write regex, and it turns out that in mir only filter-out-after works since other options end up removing lines and we end up with referencing something that does not exist. This leaves us with trunc as last line. I came up with this with help of claude
1. UTC_ARGS line:
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --filter-out-after "debug-location" --version 6
2. All 16 trunc instructions tagged with !dbg !4:
%trunc = trunc <src> %val to <dst>, !dbg !4
3. Metadata appended at end of file:
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1)
!1 = !DIFile(filename: ".", directory: ".")
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = distinct !DISubprogram(name: "trunc", scope: !1, file: !1, line: 1, unit: !0)
!4 = !DILocation(line: 1, scope: !3)
Regenerate command:
llvm/utils/update_mir_test_checks.py --llc-binary build_clang/bin/llc --force-update llvm/test/CodeGen/AMDGPU/GlobalISel/trunc-brc.ll
Note: --filter-out-after "debug-location" does NOT need to be passed on the command line.
update_mir_test_checks.py reads UTC_ARGS directly from the NOTE line in the test file
and applies them automatically.
https://github.com/llvm/llvm-project/pull/180647
More information about the llvm-commits
mailing list