Commit db6c7c5
authored
* **Dead Code Elimination**
* **Direct O(1) Hash initialization**
## Summary
The PR removes dead code and cleans up the `hipify-perl` C++ generator. It brings the generator in line with the recent O(1) single-pass token extraction architecture [ROCm#2418] by eliminating outdated components, unused metrics, and unnecessary assignments.
### Key Changes
* **Direct O(1) Hash Generation:** Replaces the legacy generation of large intermediate Perl arrays and runtime `map { $_ => 1 }` loops. The C++ backend now produces optimized native Perl hashes directly, reducing the generated script’s size and parsing time.
* **Dead Code Elimination:** Removes obsolete tracking hashes and ghost variables from the generated script that are no longer used or printed (e.g., `%tags`, `%tagsTotal`, `%Tkernels`, `%warningTags`, `%TwarningTags`, `$countIncludes`).
* **Regex and Loop Optimizations:** Removes unnecessary regex return assignments (`$k`) from some functions, permitting direct `s///g` execution. Moves redundant boolean assignments out of dictionary-generation loops.
* **C++ Generator:** Deletes orphaned string consts, cleans up unused mapping logic, and simplifies the `$tag` warning trigger block within the main tokenizer loop.
### Impact
* **Performance:** Improves Perl startup and parsing time, and reduces memory usage by eliminating unnecessary array allocations and mapping operations.
* **Maintainability:** Simplifies `CUDA2HIP_Perl.cpp` by removing unused generated code, making future updates more manageable.
* **Correctness:** All existing translation behavior, warning diagnostics, and statistical counting are fully preserved.
### Testing
* Executed syntax check: `perl -c hipify-perl`
* Uses the same exhaustive testing methodology as ROCm#2418, including a strict comparison of hipification results.
1 parent 2c66151 commit db6c7c5
2 files changed
+7946
-8048
lines changed
0 commit comments