[all-commits] [llvm/llvm-project] 064ada: [SelectionDAG][AArch64] Restrict matchUnaryPredica...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Feb 16 09:26:29 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 064ada4ec6bb4cb77d809ba366c90ca59e95d4ba
      https://github.com/llvm/llvm-project/commit/064ada4ec6bb4cb77d809ba366c90ca59e95d4ba
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-02-16 (Tue, 16 Feb 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/test/CodeGen/AArch64/sve-fixed-length-int-div.ll

  Log Message:
  -----------
  [SelectionDAG][AArch64] Restrict matchUnaryPredicate to only handle SPLAT_VECTOR for scalable vectors.

fde24661718c7812a20a10e518cd853e8e060107 added support for
scalable vectors to matchUnaryPredicate by handling SPLAT_VECTOR in
addition to BUILD_VECTOR. This was used to enabled UDIV/SDIV/UREM/SREM
by constant expansion in BuildUDIV/BuildSDIV in TargetLowering.cpp

The caller there expects to call getBuildVector from the match factors.
This leads to a crash right now if there is a SPLAT_VECTOR of
fixed vectors since the number of vectors won't match the number
of elements.

To fix this, this patch updates the callers to check the opcode
instead of whether the type is fixed or scalable. This assumes
that only 3 opcodes are handled by matchUnaryPredicate so
I've added an assertion to the final else to check that opcode.

Reviewed By: RKSimon

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




More information about the All-commits mailing list