[all-commits] [llvm/llvm-project] 3a39bb: [SelectionDAG] Use correct boolean representation ...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Thu Apr 28 09:42:36 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3a39bb96ca812d1cbd027803112e94f701ad8687
      https://github.com/llvm/llvm-project/commit/3a39bb96ca812d1cbd027803112e94f701ad8687
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2022-04-28 (Thu, 28 Apr 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    A llvm/test/CodeGen/RISCV/fold-vector-cmp.ll

  Log Message:
  -----------
  [SelectionDAG] Use correct boolean representation in FoldConstantArithmetic

The description of SETCC says
  /// SetCC operator - This evaluates to a true value iff the condition is
  /// true.  If the result value type is not i1 then the high bits conform
  /// to getBooleanContents.

Without this patch, we sign extended the i1 to the used larger type
regardless of getBooleanContents. This resulted in miscompiles, as
shown in the attached testcase that ended up returning -1 instead of
1 when using -mattr=+v.

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

Reviewed By: craig.topper

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




More information about the All-commits mailing list