[LLVMbugs] [Bug 21048] New: initialization of global var with a (sqrt) function optimized away

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 23 15:33:21 PDT 2014


            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: unassignedbugs at nondot.org
          Reporter: will_schmidt at vnet.ibm.com
                CC: llvmbugs at cs.uiuc.edu
    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" {
  %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" {
  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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140923/261e9a2e/attachment.html>

More information about the llvm-bugs mailing list