[all-commits] [llvm/llvm-project] 27a079: [InstCombine] Fix infinite loop due to bitcast <->...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Dec 31 07:17:51 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 27a0795943fee0f30b995fe5165428afc2dfd402
      https://github.com/llvm/llvm-project/commit/27a0795943fee0f30b995fe5165428afc2dfd402
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2019-12-31 (Tue, 31 Dec 2019)

  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 adding manually removing the old phis.

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




More information about the All-commits mailing list