aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-24 14:24:54 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-24 14:24:54 -0800
commit4e496f412d91af87290b3399a7e73025958ad511 (patch)
tree8cd37298858aed7b3986a9c44341a85a36ba67ae
parente5dc5083e4c2ade01146c6e9aeba0b39ef839290 (diff)
select
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index 3a3b3e1c2b..f0ea1b0ea9 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/lib/Target/CppBackend/CPPBackend.cpp
@@ -1724,11 +1724,8 @@ std::string CppWriter::generateInstruction(const Instruction *I) {
break;
}
case Instruction::Select: {
- const SelectInst* sel = cast<SelectInst>(I);
- Out << "SelectInst* " << getCppName(sel) << " = SelectInst::Create(";
- Out << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", \"";
- printEscapedString(sel->getName());
- Out << "\", " << bbname << ");";
+ const SelectInst* SI = cast<SelectInst>(I);
+ text = getValueAsStr(SI->getCondition()) + " ? " + getValueAsStr(SI->getTrueValue()) + " : " + getValueAsStr(SI->getFalseValue()) + ';';
break;
}
case Instruction::UserOp1: