The last use in a block that doesn't have successors
authorDan Gohman <gohman@apple.com>
Fri, 20 Mar 2009 01:28:21 +0000 (01:28 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 20 Mar 2009 01:28:21 +0000 (01:28 +0000)
(return or unreachable) is a kill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67357 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LiveValues.cpp

index 2634463df2096f088a049cee469ded644291c008..21ddf6bc363b301c82f2268f56079dac27d24931 100644 (file)
@@ -131,6 +131,11 @@ LiveValues::Memo &LiveValues::compute(const Value *V) {
     // Note the block in which this use occurs.
     M.Used.insert(UseBB);
 
+    // If the use block doesn't have successors, the value can be
+    // considered killed.
+    if (succ_begin(UseBB) == succ_end(UseBB))
+      M.Killed.insert(UseBB);
+
     // Observe whether the value is used outside of the loop in which
     // it is defined. Switch to an enclosing loop if necessary.
     for (; L; L = L->getParentLoop())