[LLVMbugs] [Bug 10267] New: instcombine deoptimizes testcase

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 4 12:38:30 PDT 2011


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

           Summary: instcombine deoptimizes testcase
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu


In the attached testcase, instcombine converts

  %tmp2 = ptrtoint %struct.Shape* %tmp9 to i64
  %and = and i64 %tmp2, -2
  %tmp5 = inttoptr i64 %and to %struct.Shape*
  %tobool = icmp ne %struct.Shape* %tmp5, null
  br i1 %tobool, label %land.lhs.true, label %if.end

land.lhs.true:                                    ; preds = %entry
  %propid = getelementptr inbounds %struct.Shape* %tmp5, i32 0, i32 2

to

  %tobool = icmp ugt %struct.Shape* %tmp9, inttoptr (i64 1 to %struct.Shape*)
  br i1 %tobool, label %land.lhs.true, label %if.end

land.lhs.true:                                    ; preds = %entry
  %tmp2 = ptrtoint %struct.Shape* %tmp9 to i64
  %and = and i64 %tmp2, -2
  %tmp5 = inttoptr i64 %and to %struct.Shape*
  %propid = getelementptr inbounds %struct.Shape* %tmp5, i64 0, i32 2

The first one produces:

    movq    (%rcx,%rax,8), %rdx
    andq    $-2, %rdx
    je    LBB0_3
## BB#1:                                ## %land.lhs.true
    cmpq    %rdi, 8(%rdx)
    jne    LBB0_3

The second one produces

    movq    (%rcx,%rax,8), %rdx
    cmpq    $2, %rdx
    jb    LBB0_3
## BB#1:                                ## %land.lhs.true
    andq    $-2, %rdx
    cmpq    %rdi, 8(%rdx)
    jne    LBB0_3

Note the extra "cmpq    $2, %rdx"

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list