diff options
author | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2017-03-11 00:14:52 +0000 |
---|---|---|
committer | Stanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com> | 2017-03-11 00:14:52 +0000 |
commit | b546174b0e001bf69f4588c915bf85196adfd8f7 (patch) | |
tree | fb6c4f4a16ef117798091169738db061bf572821 /llvm/unittests/MI | |
parent | 31d01baa9f3a57de8e159f84660d36a042bab5af (diff) | |
download | llvm-b546174b0e001bf69f4588c915bf85196adfd8f7.zip llvm-b546174b0e001bf69f4588c915bf85196adfd8f7.tar.gz llvm-b546174b0e001bf69f4588c915bf85196adfd8f7.tar.bz2 |
Fix subreg value numbers in handleMoveUp
The problem can occur in presence of subregs. If we are swapping two
instructions defining different subregs of the same register we will
get a new liveout from a block. We need to preserve value number for
block's liveout for successor block's livein to match.
Differential Revision: https://reviews.llvm.org/D30558
llvm-svn: 297534
Diffstat (limited to 'llvm/unittests/MI')
-rw-r--r-- | llvm/unittests/MI/LiveIntervalTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/unittests/MI/LiveIntervalTest.cpp b/llvm/unittests/MI/LiveIntervalTest.cpp index 2fd2bae..026fb42 100644 --- a/llvm/unittests/MI/LiveIntervalTest.cpp +++ b/llvm/unittests/MI/LiveIntervalTest.cpp @@ -382,6 +382,24 @@ TEST(LiveIntervalTest, SubRegMoveDown) { }); } +TEST(LiveIntervalTest, SubRegMoveUp) { + // handleMoveUp had a bug not updating valno of segment incoming to bb.2 + // after swapping subreg definitions. + liveIntervalTest(R"MIR( + successors: %bb.1, %bb.2 + undef %0.sub0 = IMPLICIT_DEF + %0.sub1 = IMPLICIT_DEF + S_CBRANCH_VCCNZ %bb.2, implicit undef %vcc + S_BRANCH %bb.1 + bb.1: + S_NOP 0, implicit %0.sub1 + bb.2: + S_NOP 0, implicit %0.sub1 +)MIR", [](MachineFunction &MF, LiveIntervals &LIS) { + testHandleMove(MF, LIS, 1, 0); + }); +} + int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); initLLVM(); |