#include "lp_bld_flow.h"
-#define LP_BUILD_FLOW_MAX_VARIABLES 32
+#define LP_BUILD_FLOW_MAX_VARIABLES 64
#define LP_BUILD_FLOW_MAX_DEPTH 32
/**
/* for each variable, update the Phi node with a (variable, block) pair */
for(i = 0; i < skip->num_variables; ++i) {
assert(*flow->variables[i]);
+ assert(LLVMTypeOf(skip->phi[i]) == LLVMTypeOf(*flow->variables[i]));
LLVMAddIncoming(skip->phi[i], flow->variables[i], ¤t_block, 1);
}
/* add (variable, block) tuples to the phi nodes */
for(i = 0; i < skip->num_variables; ++i) {
assert(*flow->variables[i]);
+ assert(LLVMTypeOf(skip->phi[i]) == LLVMTypeOf(*flow->variables[i]));
LLVMAddIncoming(skip->phi[i], flow->variables[i], ¤t_block, 1);
*flow->variables[i] = skip->phi[i];
}
LLVMBuilderRef first_builder = LLVMCreateBuilder();
LLVMValueRef res;
- LLVMPositionBuilderAtEnd(first_builder, first_block);
- LLVMPositionBuilderBefore(first_builder, first_instr);
+ if (first_instr) {
+ LLVMPositionBuilderBefore(first_builder, first_instr);
+ } else {
+ LLVMPositionBuilderAtEnd(first_builder, first_block);
+ }
res = LLVMBuildAlloca(first_builder, type, name);
* first block may prevent the X86 backend from successfully align the stack as
* required.
*
- * Also the scalarrepl pass is supossedly more powerful and can promote
+ * Also the scalarrepl pass is supposedly more powerful and can promote
* arrays in many cases.
*
* See also:
LLVMBuilderRef first_builder = LLVMCreateBuilder();
LLVMValueRef res;
- LLVMPositionBuilderBefore(first_builder, first_instr);
+ if (first_instr) {
+ LLVMPositionBuilderBefore(first_builder, first_instr);
+ } else {
+ LLVMPositionBuilderAtEnd(first_builder, first_block);
+ }
res = LLVMBuildArrayAlloca(first_builder, type, count, name);