stub out codegen of binary plus. We now compile:
if (11 + 42) {
to:
%tmp = add i32 11, 42 ; <i32> [#uses=1]
%tobool = icmp ne i32 %tmp, 0 ; <i1> [#uses=1]
br i1 %tobool, label %ifthen, label %ifend
but this doesn't handle any of the interesting/hard stuff yet.
llvm-svn: 39545
diff --git a/clang/CodeGen/CGStmt.cpp b/clang/CodeGen/CGStmt.cpp
index 8e114a4..c8f02a1 100644
--- a/clang/CodeGen/CGStmt.cpp
+++ b/clang/CodeGen/CGStmt.cpp
@@ -119,7 +119,7 @@
// Compare against zero for integers.
BoolCondVal = CondVal.getVal();
llvm::Value *Zero = Constant::getNullValue(BoolCondVal->getType());
- BoolCondVal = Builder.CreateICmpNE(BoolCondVal, Zero);
+ BoolCondVal = Builder.CreateICmpNE(BoolCondVal, Zero, "tobool");
break;
}
case BuiltinType::Float:
@@ -129,7 +129,7 @@
BoolCondVal = CondVal.getVal();
llvm::Value *Zero = Constant::getNullValue(BoolCondVal->getType());
// FIXME: llvm-gcc produces a une comparison: validate this is right.
- BoolCondVal = Builder.CreateFCmpUNE(BoolCondVal, Zero);
+ BoolCondVal = Builder.CreateFCmpUNE(BoolCondVal, Zero, "tobool");
break;
}
@@ -141,7 +141,7 @@
} else if (isa<PointerType>(CondTy)) {
BoolCondVal = CondVal.getVal();
llvm::Value *NullPtr = Constant::getNullValue(BoolCondVal->getType());
- BoolCondVal = Builder.CreateICmpNE(BoolCondVal, NullPtr);
+ BoolCondVal = Builder.CreateICmpNE(BoolCondVal, NullPtr, "tobool");
} else {
const TagType *TT = cast<TagType>(CondTy);
@@ -149,7 +149,7 @@
// Compare against zero.
BoolCondVal = CondVal.getVal();
llvm::Value *Zero = Constant::getNullValue(BoolCondVal->getType());
- BoolCondVal = Builder.CreateICmpNE(BoolCondVal, Zero);
+ BoolCondVal = Builder.CreateICmpNE(BoolCondVal, Zero, "tobool");
}
BasicBlock *ContBlock = new BasicBlock("ifend");