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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to