Commit 6aa04c422b

Andrew Kelley <superjoe30@gmail.com>
2017-08-26 02:44:32
float division by zero check only when FloatMode.Optimzed
closes #395
1 parent a0223e5
Changed files (1)
src/codegen.cpp
@@ -1269,7 +1269,7 @@ static LLVMValueRef gen_div(CodeGen *g, bool want_debug_safety, bool want_fast_m
     ZigLLVMSetFastMath(g->builder, want_fast_math);
 
     LLVMValueRef zero = LLVMConstNull(type_entry->type_ref);
-    if (want_debug_safety) {
+    if (want_debug_safety && (want_fast_math || type_entry->id != TypeTableEntryIdFloat)) {
         LLVMValueRef is_zero_bit;
         if (type_entry->id == TypeTableEntryIdInt) {
             is_zero_bit = LLVMBuildICmp(g->builder, LLVMIntEQ, val2, zero, "");