Fix operation folding checking instruction, not argument

This commit is contained in:
baldurk
2015-07-29 23:51:56 +02:00
parent bce7cde005
commit 8dd535eb26
@@ -967,9 +967,10 @@ struct SPVModule
SPVInstruction *arg = instr->op->arguments[a];
// don't fold up too complex an operation
if(instr->op)
if(arg->op)
{
if(instr->op->complexity > 1 || instr->op->arguments.size() > 2)
// allow access chains to have multiple arguments
if(arg->op->complexity > 1 || (arg->op->arguments.size() > 2 && arg->opcode != spv::OpAccessChain))
continue;
}