http://llvm.org/bugs/show_bug.cgi?id=21048

            Bug ID: 21048
           Summary: initialization of global var with a (sqrt) function
                    optimized away
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 13078
  --> http://llvm.org/bugs/attachment.cgi?id=13078&action=edit
test source

The initialization of a double to NaN (by way of sqrt(-2.01)) is failing, due
to the sqrt call being optimized out.   

Per debug, this appears to be occurring during the "Early CSE" pass. 

opt -O1 -S -o optimized.ll  llvm_debug_variable_init.ll 

The llvm_debug_variable_init.ll file contains a snippet including:

define void @__cxx_global_var_init() section ".text.startup" {
entry:
  %0 = call double @llvm.sqrt.f64(double -2.010000e+00), !dbg !1818
  store double %0, double* getelementptr inbounds (%"NumberUnion"* @fruity ,
i32 0, i32 0), align 8, !dbg !1818
  ret void, !dbg !1818
}

The optimized.ll output contains:
define void @__cxx_global_var_init() #0 section ".text.startup" {
entry:
  store double 0.000000e+00, double* getelementptr inbounds (%NumberUnion*
@fruity, i64 0, i32 0), align 8
  ret void
}

... with no sign of the sqrt call.


output from 
"opt llvm_debug_variable_init.ll  -O1 -S --print-after-all  --print-before-all 
> optimized_debug.ll 2>&1 " will also be attached momentarily.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to