[all-commits] [llvm/llvm-project] b4dd92: [InstCombine] Make combineLoadToNewType a method; NFC

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jan 14 11:46:58 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b4dd928ffbb8232d6909b640d3affcd531681ffb
      https://github.com/llvm/llvm-project/commit/b4dd928ffbb8232d6909b640d3affcd531681ffb
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-01-14 (Tue, 14 Jan 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp

  Log Message:
  -----------
  [InstCombine] Make combineLoadToNewType a method; NFC

So it can be reused as part of other combines.
In particular for D71164.


  Commit: 65c0805be523445d7ad0f12e90f53648e1ae9f84
      https://github.com/llvm/llvm-project/commit/65c0805be523445d7ad0f12e90f53648e1ae9f84
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-01-14 (Tue, 14 Jan 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    A llvm/test/Transforms/InstCombine/pr44245.ll

  Log Message:
  -----------
  [InstCombine] Fix infinite loop due to bitcast <-> phi transforms

Fix for https://bugs.llvm.org/show_bug.cgi?id=44245.

The optimizeBitCastFromPhi() and FoldPHIArgOpIntoPHI() end up
fighting against each other, because optimizeBitCastFromPhi()
assumes that bitcasts of loads will get folded. This doesn't
happen here, because a dangling phi node prevents the one-use
fold in https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp#L620-L628 from triggering.

This patch fixes the issue by explicitly performing the load
combine as part of the bitcast of phi transform. Other attempts
to force the load to be combined first were ultimately too
unreliable.

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


Compare: https://github.com/llvm/llvm-project/compare/652cd7c1007a...65c0805be523


More information about the All-commits mailing list