[all-commits] [llvm/llvm-project] 3212a0: [Constant] Allow ConstantAggregateZero a scalable ...

Fraser Cormack via All-commits all-commits at lists.llvm.org
Mon May 10 05:59:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3212a08a8c811441ca68009118758998750ce905
      https://github.com/llvm/llvm-project/commit/3212a08a8c811441ca68009118758998750ce905
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2021-05-10 (Mon, 10 May 2021)

  Changed paths:
    M llvm/include/llvm/IR/Constants.h
    M llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
    M llvm/lib/IR/Constants.cpp
    A llvm/test/Transforms/InstCombine/scalable-select.ll

  Log Message:
  -----------
  [Constant] Allow ConstantAggregateZero a scalable element count

A ConstantAggregateZero may be created from a scalable vector type.
However, it still assumed fixed number of elements when queried for
them. This patch changes ConstantAggregateZero to correctly report its
element count.

This change fixes a couple of issues. Firstly, it fixes a crash in
Constant::getUniqueValue when called on a scalable-vector
zeroinitializer constant.

Secondly, it fixes a latent bug in GlobalISel's IRTranslator in which
translating a scalable-vector zeroinitializer would hit the assertion in
ConstantAggregateZero::getNumElements when casting to a FixedVectorType,
rather than reporting an error more gracefully. This is currently
hypothetical as the IRTranslator has deeper issues preventing the use of
scalable vector types.

Reviewed By: RKSimon

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




More information about the All-commits mailing list