[all-commits] [llvm/llvm-project] 3e32b7: [InstCombine] Let combineLoadToNewType preserve AB...

Juneyoung Lee via All-commits all-commits at lists.llvm.org
Tue Jan 14 10:21:00 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3e32b7e12701de772b1cdf855b42253650a1e997
      https://github.com/llvm/llvm-project/commit/3e32b7e12701de772b1cdf855b42253650a1e997
  Author: Juneyoung Lee <aqjune at gmail.com>
  Date:   2020-01-15 (Wed, 15 Jan 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
    M llvm/test/Transforms/InstCombine/load-bitcast64.ll

  Log Message:
  -----------
  [InstCombine] Let combineLoadToNewType preserve ABI alignment of the load (PR44543)

Summary:
If aligment on `LoadInst` isn't specified, load is assumed to be ABI-aligned.
And said aligment may be different for different types.
So if we change load type, but don't pay extra attention to the aligment
(i.e. keep it unspecified), we may either overpromise (if the default aligment
of the new type is higher), or underpromise (if the default aligment
of the new type is smaller).

Thus, if no alignment is specified, we need to manually preserve the implied ABI alignment.

This addresses https://bugs.llvm.org/show_bug.cgi?id=44543 by making combineLoadToNewType preserve ABI alignment of the load.

Reviewers: spatel, lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list