[all-commits] [llvm/llvm-project] accc6b: LoadInst should store Align, not MaybeAlign.

Eli Friedman via All-commits all-commits at lists.llvm.org
Thu May 14 13:19:51 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: accc6b55450510577f9cfa0b434c97e45ab5d6c6
      https://github.com/llvm/llvm-project/commit/accc6b55450510577f9cfa0b434c97e45ab5d6c6
  Author: Eli Friedman <efriedma at quicinc.com>
  Date:   2020-05-14 (Thu, 14 May 2020)

  Changed paths:
    M llvm/include/llvm/IR/Instructions.h
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/lib/IR/Core.cpp
    M llvm/lib/IR/Instructions.cpp
    M llvm/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
    M llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
    M llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
    M llvm/lib/Transforms/Scalar/GVNHoist.cpp

  Log Message:
  -----------
  LoadInst should store Align, not MaybeAlign.

The fact that loads and stores can have the alignment missing is a
constant source of confusion: code that usually works can break down in
rare cases.  So fix the LoadInst API so the alignment is never missing.

To reduce the number of changes required to make this work, IRBuilder
and certain LoadInst constructors will grab the module's datalayout and
compute the alignment automatically.  This is the same alignment
instcombine would eventually apply anyway; we're just doing it earlier.
There's a minor risk that the way we're retrieving the datalayout
could break out-of-tree code, but I don't think that's likely.

This is the last in a series of patches, so most of the necessary
changes have already been merged.

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




More information about the All-commits mailing list