[all-commits] [llvm/llvm-project] 3f10d9: [InstCombine][NFC] Use uint64_t for ExtractIdx in ...

ahradwan2-public via All-commits all-commits at lists.llvm.org
Mon Sep 28 11:46:02 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3f10d989c803cc2bbc4e0a1a741eb9408979b19b
      https://github.com/llvm/llvm-project/commit/3f10d989c803cc2bbc4e0a1a741eb9408979b19b
  Author: ahradwan2-public <ahmedwahab1997 at gmail.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

  Log Message:
  -----------
  [InstCombine][NFC] Use uint64_t for ExtractIdx in vector_extract fold (#225156)

## Summary
This changes `ExtractIdx` from `unsigned` to `uint64_t` in the
`Intrinsic::vector_extract` case.

    unsigned ExtractIdx = cast<ConstantInt>(Idx)->getZExtValue();

`ExtractIdx` is initialized from the extract index operand via
`getZExtValue()` , which returns `uint64_t`. In the
`get_active_lane_mask` sub-case, it is scaled and compared against the
mask's upper bound:

    if (ExtractIdx * ScaleFactor >= ALMUpperBound->getZExtValue())

Here `ALMUpperBound->getZExtValue()` returns `uint64_t`, and
`ScaleFactor` is `unsigned`.

With `ExtractIdx` declared `unsigned`, the value from `getZExtValue()`
is truncated to 32 bits, and the product `ExtractIdx * ScaleFactor` is
computed in 32 bits before being widened to compare against the
`uint64_t` right-hand side. Declaring `ExtractIdx` as `uint64_t` removes
the truncation and performs the comparison in the same width as the RHS.

Assisted by: Cline

---------

Co-authored-by: Ahmed Radwan <ahradwan at amd.com>



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