Mercurial > projects > ldc
diff gen/arrays.cpp @ 162:1856c62af24b trunk
[svn r178] Fixed codegen values for function arguments, the old approach was completely broken, amazing it even worked...
author | lindquist |
---|---|
date | Mon, 05 May 2008 00:56:53 +0200 |
parents | 5c17f81fc1c1 |
children | a8cd9bc1021a |
line wrap: on
line diff
--- a/gen/arrays.cpp Sun May 04 21:25:48 2008 +0200 +++ b/gen/arrays.cpp Mon May 05 00:56:53 2008 +0200 @@ -604,6 +604,17 @@ Type* t1 = DtoDType(exp1->type); Type* t2 = DtoDType(exp2->type); + // handle reverse case + if (t2->next && t1 == DtoDType(t2->next)) + { + Type* tmp = t1; + t1 = t2; + t2 = tmp; + Expression* e = exp1; + exp1 = exp2; + exp2 = e; + } + assert(t1->ty == Tarray); assert(t2 == DtoDType(t1->next)); @@ -778,7 +789,7 @@ if (r == NULL) { llvm::Value* ll = gIR->ir->CreateLoad(DtoGEPi(l, 0,0, "tmp"),"tmp"); - llvm::Value* rl = DtoConstSize_t(0); + llvm::Value* rl = llvm::Constant::getNullValue(ll->getType());//DtoConstSize_t(0); llvm::Value* b1 = gIR->ir->CreateICmp(pred,ll,rl,"tmp"); llvm::Value* lp = gIR->ir->CreateLoad(DtoGEPi(l, 0,1, "tmp"),"tmp");