From 769b8d59d9fed7a346f11ccb952db9a9c1bcbace Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 15 Dec 2013 14:34:57 -0800 Subject: [PATCH] Fixing some constant checks. --- src/alloy/hir/function_builder.cc | 37 ++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/alloy/hir/function_builder.cc b/src/alloy/hir/function_builder.cc index b77c8afe7..8c0c3dcce 100644 --- a/src/alloy/hir/function_builder.cc +++ b/src/alloy/hir/function_builder.cc @@ -349,7 +349,6 @@ Value* FunctionBuilder::CloneValue(Value* source) { } void FunctionBuilder::Comment(const char* format, ...) { - char buffer[1024]; va_list args; va_start(args, format); @@ -378,8 +377,10 @@ void FunctionBuilder::DebugBreak() { } void FunctionBuilder::DebugBreakTrue(Value* cond) { - if (cond->IsConstantTrue()) { - DebugBreak(); + if (cond->IsConstant()) { + if (cond->IsConstantTrue()) { + DebugBreak(); + } return; } @@ -396,8 +397,10 @@ void FunctionBuilder::Trap() { } void FunctionBuilder::TrapTrue(Value* cond) { - if (cond->IsConstantTrue()) { - Trap(); + if (cond->IsConstant()) { + if (cond->IsConstantTrue()) { + Trap(); + } return; } @@ -417,8 +420,10 @@ void FunctionBuilder::Call( void FunctionBuilder::CallTrue( Value* cond, FunctionInfo* symbol_info, uint32_t call_flags) { - if (cond->IsConstantTrue()) { - Call(symbol_info, call_flags); + if (cond->IsConstant()) { + if (cond->IsConstantTrue()) { + Call(symbol_info, call_flags); + } return; } @@ -440,8 +445,10 @@ void FunctionBuilder::CallIndirect( void FunctionBuilder::CallIndirectTrue( Value* cond, Value* value, uint32_t call_flags) { - if (cond->IsConstantTrue()) { - CallIndirect(value, call_flags); + if (cond->IsConstant()) { + if (cond->IsConstantTrue()) { + CallIndirect(value, call_flags); + } return; } @@ -474,8 +481,10 @@ void FunctionBuilder::Branch(Label* label, uint32_t branch_flags) { void FunctionBuilder::BranchTrue( Value* cond, Label* label, uint32_t branch_flags) { - if (cond->IsConstantTrue()) { - Branch(label, branch_flags); + if (cond->IsConstant()) { + if (cond->IsConstantTrue()) { + Branch(label, branch_flags); + } return; } @@ -488,8 +497,10 @@ void FunctionBuilder::BranchTrue( void FunctionBuilder::BranchFalse( Value* cond, Label* label, uint32_t branch_flags) { - if (cond->IsConstantFalse()) { - Branch(label, branch_flags); + if (cond->IsConstant()) { + if (cond->IsConstantFalse()) { + Branch(label, branch_flags); + } return; }