[PATCH] D88851: InstCombine: Fix infinite loop in copy-constant-to-alloca transform

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 14:04:47 PDT 2020


arsenm created this revision.
arsenm added reviewers: asbirlea, yaxunl, jdoerfert, rnk, majnemer, craig.topper, nikic.
Herald added subscribers: kerbowa, pengfei, hiraditya, nhaehnle, jvesely.
Herald added a project: LLVM.
arsenm requested review of this revision.
Herald added a subscriber: wdng.

This was broken by 16295d521e294b27106e51fac29957c1aac8ff89 <https://reviews.llvm.org/rG16295d521e294b27106e51fac29957c1aac8ff89>, when
instructions started being handled and not just constant
expressions. This was re-inserting an equivalent bitcast to the
original memcpy operand, which made a non-functional IR change on
every iteration.

      

This also fixes a secondary problem where it was inserting
addrspacecasts which may not have been legal (i.e. it changed the
source address space). Start visiting all pointer users and fail out
if we can't process them. Also start handling the relevant memory
intrinsic users. These cases can be dealt with by running
InferAddressSpaces separately.


https://reviews.llvm.org/D88851

Files:
  llvm/include/llvm/IR/IRBuilder.h
  llvm/lib/IR/IRBuilder.cpp
  llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
  llvm/test/Transforms/InstCombine/AMDGPU/memcpy-from-constant.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88851.296295.patch
Type: text/x-patch
Size: 17103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201005/c4269791/attachment.bin>


More information about the llvm-commits mailing list