Fixing some constant checks.

This commit is contained in:
Ben Vanik 2013-12-15 14:34:57 -08:00
parent 84651623a5
commit 769b8d59d9
1 changed files with 24 additions and 13 deletions

View File

@ -349,7 +349,6 @@ Value* FunctionBuilder::CloneValue(Value* source) {
} }
void FunctionBuilder::Comment(const char* format, ...) { void FunctionBuilder::Comment(const char* format, ...) {
char buffer[1024]; char buffer[1024];
va_list args; va_list args;
va_start(args, format); va_start(args, format);
@ -378,8 +377,10 @@ void FunctionBuilder::DebugBreak() {
} }
void FunctionBuilder::DebugBreakTrue(Value* cond) { void FunctionBuilder::DebugBreakTrue(Value* cond) {
if (cond->IsConstantTrue()) { if (cond->IsConstant()) {
DebugBreak(); if (cond->IsConstantTrue()) {
DebugBreak();
}
return; return;
} }
@ -396,8 +397,10 @@ void FunctionBuilder::Trap() {
} }
void FunctionBuilder::TrapTrue(Value* cond) { void FunctionBuilder::TrapTrue(Value* cond) {
if (cond->IsConstantTrue()) { if (cond->IsConstant()) {
Trap(); if (cond->IsConstantTrue()) {
Trap();
}
return; return;
} }
@ -417,8 +420,10 @@ void FunctionBuilder::Call(
void FunctionBuilder::CallTrue( void FunctionBuilder::CallTrue(
Value* cond, FunctionInfo* symbol_info, uint32_t call_flags) { Value* cond, FunctionInfo* symbol_info, uint32_t call_flags) {
if (cond->IsConstantTrue()) { if (cond->IsConstant()) {
Call(symbol_info, call_flags); if (cond->IsConstantTrue()) {
Call(symbol_info, call_flags);
}
return; return;
} }
@ -440,8 +445,10 @@ void FunctionBuilder::CallIndirect(
void FunctionBuilder::CallIndirectTrue( void FunctionBuilder::CallIndirectTrue(
Value* cond, Value* value, uint32_t call_flags) { Value* cond, Value* value, uint32_t call_flags) {
if (cond->IsConstantTrue()) { if (cond->IsConstant()) {
CallIndirect(value, call_flags); if (cond->IsConstantTrue()) {
CallIndirect(value, call_flags);
}
return; return;
} }
@ -474,8 +481,10 @@ void FunctionBuilder::Branch(Label* label, uint32_t branch_flags) {
void FunctionBuilder::BranchTrue( void FunctionBuilder::BranchTrue(
Value* cond, Label* label, uint32_t branch_flags) { Value* cond, Label* label, uint32_t branch_flags) {
if (cond->IsConstantTrue()) { if (cond->IsConstant()) {
Branch(label, branch_flags); if (cond->IsConstantTrue()) {
Branch(label, branch_flags);
}
return; return;
} }
@ -488,8 +497,10 @@ void FunctionBuilder::BranchTrue(
void FunctionBuilder::BranchFalse( void FunctionBuilder::BranchFalse(
Value* cond, Label* label, uint32_t branch_flags) { Value* cond, Label* label, uint32_t branch_flags) {
if (cond->IsConstantFalse()) { if (cond->IsConstant()) {
Branch(label, branch_flags); if (cond->IsConstantFalse()) {
Branch(label, branch_flags);
}
return; return;
} }