[svn r386] Fixed broken DtoBoolean.

Some code cleanup.
This commit is contained in:
Tomas Lindquist Olsen
2008-07-15 00:17:03 +02:00
parent 25dea7a16e
commit 86a3f53cfe
7 changed files with 81 additions and 58 deletions

View File

@@ -967,12 +967,12 @@ void ForeachStatement::toIR(IRState* p)
LLValue* done = 0;
LLValue* load = DtoLoad(keyvar);
if (op == TOKforeach) {
done = new llvm::ICmpInst(llvm::ICmpInst::ICMP_ULT, load, niters, "tmp", p->scopebb());
done = p->ir->CreateICmpULT(load, niters, "tmp");
}
else if (op == TOKforeach_reverse) {
done = new llvm::ICmpInst(llvm::ICmpInst::ICMP_UGT, load, zerokey, "tmp", p->scopebb());
load = llvm::BinaryOperator::createSub(load,llvm::ConstantInt::get(keytype, 1, false),"tmp",p->scopebb());
new llvm::StoreInst(load, keyvar, p->scopebb());
done = p->ir->CreateICmpUGT(load, zerokey, "tmp");
load = p->ir->CreateSub(load, llvm::ConstantInt::get(keytype, 1, false), "tmp");
DtoStore(load, keyvar);
}
llvm::BranchInst::Create(bodybb, endbb, done, p->scopebb());