add an assert to make it really clear what this is doing. Return singularval as
authorChris Lattner <sabre@nondot.org>
Fri, 4 Dec 2009 01:03:32 +0000 (01:03 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 4 Dec 2009 01:03:32 +0000 (01:03 +0000)
a compile time perf optimization to avoid a load.

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

lib/Transforms/Utils/SSAUpdater.cpp

index 8a07c35f352c70a25a6690dcd27236a62f5fc9fa..ba41bf9d2e5c177da3c43fd6353115ec6e46df46 100644 (file)
@@ -295,10 +295,14 @@ Value *SSAUpdater::GetValueAtEndOfBlockInternal(BasicBlock *BB) {
       InsertedVal = SingularValue;
     }
 
+    // Either path through the 'if' should have set insertedVal -> SingularVal.
+    assert((InsertedVal == SingularValue || isa<UndefValue>(InsertedVal)) &&
+           "RAUW didn't change InsertedVal to be SingularVal");
+
     // Drop the entries we added in IncomingPredInfo to restore the stack.
     IncomingPredInfo.erase(IncomingPredInfo.begin()+FirstPredInfoEntry,
                            IncomingPredInfo.end());
-    return InsertedVal;
+    return SingularValue;
   }
 
   // Otherwise, we do need a PHI: insert one now if we don't already have one.