summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/IRInterpreter.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-05-24 20:36:56 +0000
committerSean Callanan <scallanan@apple.com>2013-05-24 20:36:56 +0000
commit0b342b6ddf629005e47a2fdf9929fc7bfe162814 (patch)
treef2de0f58968f5625280a22629b57de7bd8fa0368 /lldb/source/Expression/IRInterpreter.cpp
parenteb91eac9fb866ab1243366d2e238b9961895612d (diff)
downloadbcm5719-llvm-0b342b6ddf629005e47a2fdf9929fc7bfe162814.tar.gz
bcm5719-llvm-0b342b6ddf629005e47a2fdf9929fc7bfe162814.zip
Fixed signed operations in the IR interpreter.
Scalar now can make itself signed if needed. <rdar://problem/13977632> llvm-svn: 182668
Diffstat (limited to 'lldb/source/Expression/IRInterpreter.cpp')
-rw-r--r--lldb/source/Expression/IRInterpreter.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp
index b3c35bf8e9a..5986ebb4a00 100644
--- a/lldb/source/Expression/IRInterpreter.cpp
+++ b/lldb/source/Expression/IRInterpreter.cpp
@@ -662,12 +662,16 @@ IRInterpreter::Interpret (llvm::Module &module,
result = L - R;
break;
case Instruction::SDiv:
+ L.MakeSigned();
+ R.MakeSigned();
result = L / R;
break;
case Instruction::UDiv:
result = L.GetRawBits64(0) / R.GetRawBits64(1);
break;
case Instruction::SRem:
+ L.MakeSigned();
+ R.MakeSigned();
result = L % R;
break;
case Instruction::URem:
@@ -1004,15 +1008,23 @@ IRInterpreter::Interpret (llvm::Module &module,
result = (L.GetRawBits64(0) <= R.GetRawBits64(0));
break;
case CmpInst::ICMP_SGT:
+ L.MakeSigned();
+ R.MakeSigned();
result = (L > R);
break;
case CmpInst::ICMP_SGE:
+ L.MakeSigned();
+ R.MakeSigned();
result = (L >= R);
break;
case CmpInst::ICMP_SLT:
+ L.MakeSigned();
+ R.MakeSigned();
result = (L < R);
break;
case CmpInst::ICMP_SLE:
+ L.MakeSigned();
+ R.MakeSigned();
result = (L <= R);
break;
}
OpenPOWER on IntegriCloud