[llvm] r268805 - LiveIntervalAnalysis: Fix handleMove() extending liverange for undef inputs
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Fri May 6 14:47:41 PDT 2016
Author: matze
Date: Fri May 6 16:47:41 2016
New Revision: 268805
URL: http://llvm.org/viewvc/llvm-project?rev=268805&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/trunk/unittests/MI/LiveIntervalTest.cpp
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=268805&r1=268804&r2=268805&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri May 6 16:47:41 2016
@@ -939,10 +939,13 @@ public:
hasRegMask = true;
if (!MO.isReg())
continue;
- // Aggressively clear all kill flags.
- // They are reinserted by VirtRegRewriter.
- if (MO.isUse())
+ if (MO.isUse()) {
+ if (!MO.readsReg())
+ continue;
+ // Aggressively clear all kill flags.
+ // They are reinserted by VirtRegRewriter.
MO.setIsKill(false);
+ }
unsigned Reg = MO.getReg();
if (!Reg)
Modified: llvm/trunk/unittests/MI/LiveIntervalTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/MI/LiveIntervalTest.cpp?rev=268805&r1=268804&r2=268805&view=diff
==============================================================================
--- llvm/trunk/unittests/MI/LiveIntervalTest.cpp (original)
+++ llvm/trunk/unittests/MI/LiveIntervalTest.cpp Fri May 6 16:47:41 2016
@@ -300,6 +300,17 @@ TEST(LiveIntervalTest, MoveDownKillFollo
});
}
+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) {
::testing::InitGoogleTest(&argc, argv);
initLLVM();
More information about the llvm-commits
mailing list