[llvm-bugs] [Bug 26452] New: LLVM emits divide by zero where there was none

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 3 06:20:24 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26452

            Bug ID: 26452
           Summary: LLVM emits divide by zero where there was none
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: WebAssembly
          Assignee: unassignedbugs at nondot.org
          Reporter: jfb at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This test:
 
https://github.com/gcc-mirror/gcc/tree/master/gcc/testsuite/gcc.c-torture/execute/pr60960.c

Uses 4x vectors and scalarizes the operations. It doesn't divide by zero, yet
LLVM generates the following for f1:

f1:                                     # @f1                                   
        .param          i32, i32, i32, i32, i32                                 
# BB#0:                                 # %entry                                
        i32.const       $push0=, 255                                            
        i32.and         $push3=, $2, $pop0                                      
        i32.const       $push8=, 0                                              
        i32.div_u       $2=, $pop3, $pop8                                       
        i32.const       $push19=, 255                                           
        i32.and         $push2=, $3, $pop19                                     
        i32.const       $push18=, 0                                             
        i32.div_u       $3=, $pop2, $pop18                                      
        i32.const       $push10=, 3                                             
        i32.add         $push11=, $0, $pop10                                    
        i32.const       $push17=, 255                                           
        i32.and         $push1=, $4, $pop17                                     
        i32.const       $push16=, 0                                             
        i32.div_u       $push9=, $pop1, $pop16                                  
        i32.store8      $discard=, 0($pop11):p2align=2, $pop9                   
        i32.const       $push12=, 2                                             
        i32.add         $push13=, $0, $pop12                                    
        i32.store8      $discard=, 0($pop13):p2align=2, $3                      
        i32.const       $push6=, 1                                              
        i32.add         $push14=, $0, $pop6                                     
        i32.store8      $discard=, 0($pop14):p2align=2, $2                      
        i32.const       $push4=, 254                                            
        i32.and         $push5=, $1, $pop4                                      
        i32.const       $push15=, 1                                             
        i32.shr_u       $push7=, $pop5, $pop15                                  
        i32.store8      $discard=, 0($0):p2align=2, $pop7                       
        return                                                                  
        .endfunc                                                                
.Lfunc_end0:                                                                    
        .size   f1, .Lfunc_end0-f1

-- 
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/20160203/a865bb92/attachment-0001.html>


More information about the llvm-bugs mailing list