summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/MI/LiveIntervalTest.cpp
diff options
context:
space:
mode:
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2017-03-11 00:14:52 +0000
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>2017-03-11 00:14:52 +0000
commitb546174b0e001bf69f4588c915bf85196adfd8f7 (patch)
treefb6c4f4a16ef117798091169738db061bf572821 /llvm/unittests/MI/LiveIntervalTest.cpp
parent31d01baa9f3a57de8e159f84660d36a042bab5af (diff)
downloadbcm5719-llvm-b546174b0e001bf69f4588c915bf85196adfd8f7.tar.gz
bcm5719-llvm-b546174b0e001bf69f4588c915bf85196adfd8f7.zip
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/LiveIntervalTest.cpp')
-rw-r--r--llvm/unittests/MI/LiveIntervalTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/unittests/MI/LiveIntervalTest.cpp b/llvm/unittests/MI/LiveIntervalTest.cpp
index 2fd2baecc79..026fb42d345 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();
OpenPOWER on IntegriCloud