llvm-project
5723a7d0 - [AArch64][GlobalISel] Ignore debug uses in mul-constant combine (#228100)

Commit
45 days ago
[AArch64][GlobalISel] Ignore debug uses in mul-constant combine (#228100) This PR is intended for the issue #227648. When checking whether a multiply has a single non-debug use, retrieve that use using the non-debug use iterator as well. Otherwise a DBG_VALUE can get selected instead of the actual arithmetic user, causing debug info to change the combine decision. So, my fix is as follows: 1. Use the non-debug instruction iterator, `use_nodbg_instructions()`, when retrieving the user so that it matches the preceding `hasOneNonDBGUse()` check. 2. Added a MIR regression test covering a `G_MUL` with a `DBG_VALUE` use and a single non-debug `G_ADD` user. I added the regression test in the file: `llvm/test/CodeGen/AArch64/GlobalISel/postlegalizercombiner-mulpow2.mir` since LLVM's testing guidance mentions to extend an existing relevant test file when possible. I ran the following test commands: ```bash build/bin/llvm-lit llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/postlegalizercombiner-mulpow2.mir ``` ```bash build/bin/llvm-lit llvm-project/llvm/test/CodeGen/AArch64/GlobalISel ``` ### Validation Without this fix, the patch-included regression test failed; both commands now pass successfully. <br></br> Since this issue is tagged good-first-issue, I used LLM to only setup, search and learn. Wrote the fix myself. <br></br> Fixes #227648.
Parents
Loading