| Issue |
243242
|
| Summary |
LLVM test regression in riscv64, failing CodeGen/RISCV/GlobalISel/orc-b-combine.mir
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
ajordanr-google
|
Hi @janearthur (cc @topperc),
Commit 5ae4fd672b4fc54d814671c378cefa6f77845dda (PR #240276: "[RISCV][GlobalISel] Combine byte-spreading operations to orc.b") broke `check-llvm` on builds configured with `-DLLVM_ENABLE_ASSERTIONS=OFF` (`-DNDEBUG`), including Android's LLVM ToT Stage 2 builder:
```
FAIL: LLVM :: CodeGen/RISCV/GlobalISel/orc-b-combine.mir (23056 of 71967)
# RUN: at line 4
llc -mtriple=riscv64 -mattr=+zbb -run-pass=riscv-postlegalizer-combiner -riscvpostlegalizercombiner-only-enable-rule=sub_shifts_to_orc_b -verify-machineinstrs .../llvm/test/CodeGen/RISCV/GlobalISel/orc-b-combine.mir -o - | FileCheck .../llvm/test/CodeGen/RISCV/GlobalISel/orc-b-combine.mir --check-prefix=ONLY
# | LLVM ERROR: Invalid rule identifier
```
In `llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp`, `getRuleIdxForIdentifier()` guards the `StringMatcher` for symbolic rule names behind `#ifndef NDEBUG`. When LLVM is built with `-DLLVM_ENABLE_ASSERTIONS=OFF`, `-riscvpostlegalizercombiner-only-enable-rule=sub_shifts_to_orc_b` fails to resolve the symbolic rule name and aborts with `LLVM ERROR: Invalid rule identifier` (existing tests using `-*-only-enable-rule=<name>` specify `# REQUIRES: asserts`).
**Minimal Reproducer:**
```bash
# With an LLVM build configured with -DLLVM_ENABLE_ASSERTIONS=OFF:
llc -mtriple=riscv64 -mattr=+zbb -run-pass=riscv-postlegalizer-combiner \
-riscvpostlegalizercombiner-only-enable-rule=sub_shifts_to_orc_b \
-verify-machineinstrs repro.mir -o -
```
```mir
# repro.mir
---
name: byte_bit_0
legalized: true
body: |
bb.0:
liveins: $x10
%0:_(s64) = COPY $x10
%1:_(s64) = G_CONSTANT i64 72340172838076673
%2:_(s64) = G_AND %0, %1
%3:_(s64) = G_CONSTANT i64 8
%4:_(s64) = G_SHL %2, %3
%5:_(s64) = G_SUB %4, %2
$x10 = COPY %5(s64)
PseudoRET implicit $x10
...
```
Could you please provide a fix (e.g., adding `# REQUIRES: asserts` or moving the `-riscvpostlegalizercombiner-only-enable-rule=sub_shifts_to_orc_b` RUN line to an `asserts`-gated test) or revert this commit?
cc @llvm/android-maintainers
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs