diff options
author | Zachary Turner <zturner@google.com> | 2015-01-09 21:12:22 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-01-09 21:12:22 +0000 |
commit | f16ae603e85fe4b48a09efd1c4ced1a24325aed6 (patch) | |
tree | 6ccf159c2eaea347d90995d0376f34aa394fc626 | |
parent | 96fc9a25376c29ab85ed881a087119b597bf61f4 (diff) | |
download | bcm5719-llvm-f16ae603e85fe4b48a09efd1c4ced1a24325aed6.tar.gz bcm5719-llvm-f16ae603e85fe4b48a09efd1c4ced1a24325aed6.zip |
Fix issues with LLDB's interpreter and MS ABI guard variables.
MS ABI guard variables end with @4IA, so this patch teaches the
interpreter about that. Additionally, there was an issue with
TurnGuardLoadIntoZero which was causing some guard uses of a
variable to be missed. This fixes that by calling
Instruction::replaceAllUsesWith() instead of trying to replicate
that function.
llvm-svn: 225547
-rw-r--r-- | lldb/source/Expression/IRForTarget.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index 8f5ed4be953..8e75c32183e 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -2043,8 +2043,12 @@ static bool isGuardVariableRef(Value *V) GlobalVariable *GV = dyn_cast<GlobalVariable>(Old); - if (!GV || !GV->hasName() || !GV->getName().startswith("_ZGV")) + if (!GV || !GV->hasName() || + (!GV->getName().startswith("_ZGV") && // Itanium ABI guard variable + !GV->getName().endswith("@4IA"))) // Microsoft ABI guard variable + { return false; + } return true; } @@ -2052,20 +2056,8 @@ static bool isGuardVariableRef(Value *V) void IRForTarget::TurnGuardLoadIntoZero(llvm::Instruction* guard_load) { - Constant* zero(ConstantInt::get(Type::getInt8Ty(m_module->getContext()), 0, true)); - - for (llvm::User *u : guard_load->users()) - { - if (isa<Constant>(u)) - { - // do nothing for the moment - } - else - { - u->replaceUsesOfWith(guard_load, zero); - } - } - + Constant *zero(Constant::getNullValue(guard_load->getType())); + guard_load->replaceAllUsesWith(zero); guard_load->eraseFromParent(); } |