[all-commits] [llvm/llvm-project] b552e1: [Loads] Forward constant vector store to load of f...

Nikita Popov via All-commits all-commits at lists.llvm.org
Sat Apr 3 03:10:57 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b552e16b0b04cd216753e40990da774f4a400782
      https://github.com/llvm/llvm-project/commit/b552e16b0b04cd216753e40990da774f4a400782
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-04-03 (Sat, 03 Apr 2021)

  Changed paths:
    M llvm/lib/Analysis/Loads.cpp
    M llvm/test/Transforms/InstCombine/load-store-forward.ll

  Log Message:
  -----------
  [Loads] Forward constant vector store to load of first element

InstCombine performs simple forwarding from stores to loads, but
currently only handles the case where the load and store have the
same size. This extends it to also handle a store of a constant
with a larger size followed by a load with a smaller size.

This is implemented through ConstantFoldLoadThroughBitcast() which
is fairly primitive (e.g. does not allow storing a large integer
and then loading a small one), but at least can forward the first
element of a vector store. Unfortunately it seems that we currently
don't have a generic helper for "read a constant value as a different
type", it's all tangled up with other logic in either
ConstantFolding or VNCoercion.

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




More information about the All-commits mailing list