Don't track users of undef values; they aren't interesting for
authorDan Gohman <gohman@apple.com>
Fri, 4 Jun 2010 23:16:05 +0000 (23:16 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 4 Jun 2010 23:16:05 +0000 (23:16 +0000)
register pressure.

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

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 86ea3eb6cdb04f89b1e5977c16e439af74f3a657..94df9557608fa9cb98c7a9e12e9e5d6ec954e4c2 100644 (file)
@@ -2095,8 +2095,12 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() {
     } else if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S)) {
       if (!Inserted.insert(U)) continue;
       const Value *V = U->getValue();
-      if (const Instruction *Inst = dyn_cast<Instruction>(V))
+      if (const Instruction *Inst = dyn_cast<Instruction>(V)) {
+        // Look for instructions defined outside the loop.
         if (L->contains(Inst)) continue;
+      } else if (isa<UndefValue>(V))
+        // Undef doesn't have a live range, so it doesn't matter.
+        continue;
       for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
            UI != UE; ++UI) {
         const Instruction *UserInst = dyn_cast<Instruction>(*UI);