[PATCH] D99118: [SROA] Speculate around PHIs: allow load to be in a unique-successor unique-predecessor block

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 15:00:12 PDT 2021


lebedev.ri created this revision.
lebedev.ri added reviewers: rampitec, arsenm, spatel, Carrot.
lebedev.ri added a project: LLVM.
Herald added subscribers: hiraditya, arichardson.
lebedev.ri requested review of this revision.
Herald added a subscriber: wdng.

There's `2009-02-20-InstCombine-SROA.ll` InstCombine test that uses SROA,
and it breaks if i change InstCombine to split up `inttoptr` into `bitcast(inttoptr)`.
The cause is, if we have a PHI and a load of that PHI, InstCombine may sink the load
into unique successor block. And `isSafePHIToSpeculate()` bails out on that.

So extend `isSafePHIToSpeculate()` to support traversing through such blocks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99118

Files:
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/test/Transforms/SROA/2009-02-20-InstCombine-SROA.ll
  llvm/test/Transforms/SROA/phi-with-duplicate-pred.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99118.332441.patch
Type: text/x-patch
Size: 16302 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210322/f62decdf/attachment.bin>


More information about the llvm-commits mailing list