[all-commits] [llvm/llvm-project] 112c1c: [IVDescriptor] Make sure the sign is included for ...

Florian Hahn via All-commits all-commits at lists.llvm.org
Mon Nov 15 05:13:40 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 112c1c346a61459238d286fe6a649842fcbcd7ce
      https://github.com/llvm/llvm-project/commit/112c1c346a61459238d286fe6a649842fcbcd7ce
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2021-11-15 (Mon, 15 Nov 2021)

  Changed paths:
    M llvm/lib/Analysis/IVDescriptors.cpp
    M llvm/test/Transforms/LoopVectorize/reduction-small-size.ll

  Log Message:
  -----------
  [IVDescriptor] Make sure the sign is included for negative extension.

At the moment, computeRecurrenceType does not include any sign bits in
the maximum bit width. If the value can be negative, this means the sign
bit will be missing and the sext won't properly extend the value.

If the value can be negative, increment the bitwidth by one to make sure
there is at least one sign bit in the result value.

Note that the increment is also needed *if* the value is *known* to be
negative, as a sign bit needs to be preserved for the sext to work.

Note that this at the moment prevents vectorization, because the
analysis computes i1 as type for the recurrence when looking through the
AND in lookThroughAnd.

Fixes PR51794, PR52485.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D113056




More information about the All-commits mailing list