LiveIntervalAnalysis: Fix handleMove() extending liverange for undef inputs

Fix handleMove() incorrectly extending liveranges when an undef input of
a vreg was moved past the (current) end of the liverange.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268805 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun 2016-05-06 21:47:41 +00:00
parent bcb4c00b78
commit 3783c29658
2 changed files with 17 additions and 3 deletions

View File

@ -939,10 +939,13 @@ public:
hasRegMask = true; hasRegMask = true;
if (!MO.isReg()) if (!MO.isReg())
continue; continue;
// Aggressively clear all kill flags. if (MO.isUse()) {
// They are reinserted by VirtRegRewriter. if (!MO.readsReg())
if (MO.isUse()) continue;
// Aggressively clear all kill flags.
// They are reinserted by VirtRegRewriter.
MO.setIsKill(false); MO.setIsKill(false);
}
unsigned Reg = MO.getReg(); unsigned Reg = MO.getReg();
if (!Reg) if (!Reg)

View File

@ -300,6 +300,17 @@ TEST(LiveIntervalTest, MoveDownKillFollowing) {
}); });
} }
TEST(LiveIntervalTest, MoveUndefUse) {
liveIntervalTest(
" %0 = IMPLICIT_DEF\n"
" NOOP implicit undef %0\n"
" NOOP implicit %0\n"
" NOOP\n",
[](MachineFunction &MF, LiveIntervals &LIS) {
testHandleMove(MF, LIS, 1, 3);
});
}
int main(int argc, char **argv) { int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
initLLVM(); initLLVM();