[PATCH] D87865: PR47468: Fix findPHICopyInsertPoint, so that copies aren't incorrectly inserted after an INLINEASM_BR.

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 15:44:18 PDT 2020


jyknight created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
jyknight added reviewers: nickdesaulniers, void, craig.topper.
jyknight added subscribers: manojgupta, jcai19, hans.
jyknight published this revision for review.

findPHICopyInsertPoint special cases placement in a block with a
callbr or invoke in it. In that case, we must ensure that the copy is
placed before the INLINEASM_BR or call instruction, if the register is
defined prior to that instruction, because it may jump out of the
block.

Previously, the code placed it immediately after the last def _or
use_. This is wrong, if the use is the instruction which may jump.  We
could correctly place it immediately after the last def (ignoring
uses), but that is non-optimal for register pressure.

Instead, place the copy after the last def, or before the
call/inlineasm_br, whichever is later.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87865

Files:
  llvm/lib/CodeGen/PHIEliminationUtils.cpp
  llvm/test/CodeGen/X86/callbr-asm-phi-placement.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87865.292646.patch
Type: text/x-patch
Size: 4004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200917/476a93cb/attachment.bin>


More information about the llvm-commits mailing list