Skip to content

tests: make promoteInt non-standard-width check actually fire - #2129

Open
pvelesko wants to merge 1 commit into
mainfrom
issue-2122-promoteint-grep
Open

pvelesko wants to merge 1 commit into
mainfrom
issue-2122-promoteint-grep

Conversation

@pvelesko

Copy link
Copy Markdown
Collaborator

The hipPromoteInt tests check that no odd-width integers survive HipPromoteInts, but the check used a PCRE lookbehind under grep -E, so it always counted 0 and never failed. This replaces it with a pipeline that strips comments, strings and block labels from the llvm-dis output and then counts iN types whose width is not 1/8/16/32/64. It sticks to perl, sed -E and grep -E so it also works with the BSD tools on the macOS lane.

A string attribute key containing a quote is not handled, because llvm-dis prints such keys unescaped (#2125).

Fixes #2122

This PR was generated using AI

The check used a PCRE lookbehind; grep -E (ERE) has no lookbehind, so the
count was always 0 and the check never failed (since c63b411).

The new pipeline drops comments and quoted strings in one left-to-right
perl -0 pass over the whole file (strings can span lines per LangRef, e.g.
llvm-dis prints a string attribute key with a raw newline; a quote can
appear in a comment such as a ModuleID), then strips a leading block label
per line. perl is used because sed -z is GNU-only and the macOS lane has
BSD sed. grep then extracts iN tokens not preceded by %, @, !, ., $, an
identifier character or '-', and counts those whose width is not
1/8/16/32/64. Otherwise only POSIX sed -E and grep -E are used, no \b.

Known gap: llvm-dis does not escape string attribute keys, so a key
containing a quote prints as invalid IR and is not handled (upstream LLVM
printer bug in Attribute::getAsString).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

promoteInt tests: the non-standard-width check uses a lookbehind grep -E does not support, so it never fires

1 participant