[PATCH] D18935: Fix live interval update of Dead PHI for r265547

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 9 11:01:47 PDT 2016


wmi created this revision.
wmi added a reviewer: qcolombet.
wmi added subscribers: llvm-commits, davidxl.
wmi set the repository for this revision to rL LLVM.

Before r265547, vreg defined by PHI VNI cannot be rematerialized because the def of PHI VNI has no instruction associated with it.

Now we use original def of vreg for rematerialization, so vreg defined by PHI VNI can be rematerialized. However, for rematerialization happen in splitting phase, live range update in splitting didn't update live range correctly if a PHI VNI becomes Dead after rematerialization. It will extend live range for Dead PHI, which may lead to some inconsistent state. 

The fix is: move rewriteAssigned (which will extend live range according to real vreg uses) before extendPHIKillRanges. Then at the beginning of extendPHIKillRanges, if the segment associated with PHI->def is not extended, we know this is a Dead PHI. We will remove segment for Dead PHI, and skip live range extension for such PHI.

The bug could have been caught earlier if I run tests with -verify-regalloc, which I found quite powerful to catch inconsistent state in an early stage. After the fix, I run spec2006 and llvm testsuite with -verify-regalloc successfully, which provides me some confidence about correctness.  
 

Repository:
  rL LLVM

http://reviews.llvm.org/D18935

Files:
  lib/CodeGen/SplitKit.cpp
  test/CodeGen/ARM/interval-update-remat.ll
  test/CodeGen/X86/interval-update-remat.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18935.53141.patch
Type: text/x-patch
Size: 23708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160409/8ab47f43/attachment.bin>


More information about the llvm-commits mailing list