[all-commits] [llvm/llvm-project] 6d7e7f: [InstCombine] Fold uitofp of masked truncations (#...

Harrison Hao via All-commits all-commits at lists.llvm.org
Sun Sep 13 17:59:11 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6d7e7fbafd8d010a3a4146b24e8cca2c8b7dc831
      https://github.com/llvm/llvm-project/commit/6d7e7fbafd8d010a3a4146b24e8cca2c8b7dc831
  Author: Harrison Hao <57025411+harrisonGPU at users.noreply.github.com>
  Date:   2026-09-14 (Mon, 14 Sep 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    A llvm/test/Transforms/InstCombine/uitofp.ll

  Log Message:
  -----------
  [InstCombine] Fold uitofp of masked truncations (#222592)

Fold an unsigned integer-to-floating-point conversion of a masked
truncation by widening the mask and eliminating the truncation:

`uitofp((trunc X) & C)` → `uitofp(X & zext(C))`

Apply the fold when the intermediate instructions have one use and
widening the integer operation is desirable.

This reduces the instruction count on both AMDGPU and NVPTX.

AMDGPU example: https://godbolt.org/z/rTYhM61ce
NVPTX example: https://godbolt.org/z/fWhsrne19



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list