[all-commits] [llvm/llvm-project] 3fe6a0: [LV] Check if compare is truncated directly in get...

Florian Hahn via All-commits all-commits at lists.llvm.org
Wed Sep 4 12:53:04 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3fe6a064f15cd854fd497594cc20e8b680cd2133
      https://github.com/llvm/llvm-project/commit/3fe6a064f15cd854fd497594cc20e8b680cd2133
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2024-09-04 (Wed, 04 Sep 2024)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Transforms/LoopVectorize/RISCV/truncate-to-minimal-bitwidth-cost.ll

  Log Message:
  -----------
  [LV] Check if compare is truncated directly in getInstructionCost.

The current check for truncated compares in getInstructionCost misses
cases where either the first or both operands are constants.
Check directly if the compare is marked for truncation. In that case,
the minimum bitwidth is that of the operands.

The patch also adds asserts to ensure that.

This fixes a divergence between legacy and VPlan-based cost model, where
the legacy cost model incorrectly estimated the cost of compares with
truncated operands.

Fixes https://github.com/llvm/llvm-project/issues/107171.



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