diff options
Diffstat (limited to 'llvm/lib/IR/User.cpp')
-rw-r--r-- | llvm/lib/IR/User.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/IR/User.cpp b/llvm/lib/IR/User.cpp index 68489075cd88..637af7aaa245 100644 --- a/llvm/lib/IR/User.cpp +++ b/llvm/lib/IR/User.cpp @@ -18,8 +18,9 @@ class BasicBlock; // User Class //===----------------------------------------------------------------------===// -void User::replaceUsesOfWith(Value *From, Value *To) { - if (From == To) return; // Duh what? +bool User::replaceUsesOfWith(Value *From, Value *To) { + bool Changed = false; + if (From == To) return Changed; // Duh what? assert((!isa<Constant>(this) || isa<GlobalValue>(this)) && "Cannot call User::replaceUsesOfWith on a constant!"); @@ -30,11 +31,16 @@ void User::replaceUsesOfWith(Value *From, Value *To) { // "To", adding "this" to the uses list of To, and // most importantly, removing "this" from the use list of "From". setOperand(i, To); + Changed = true; } if (auto DVI = dyn_cast_or_null<DbgVariableIntrinsic>(this)) { - if (is_contained(DVI->location_ops(), From)) + if (is_contained(DVI->location_ops(), From)) { DVI->replaceVariableLocationOp(From, To); + Changed = true; + } } + + return Changed; } //===----------------------------------------------------------------------===// |