[LLVMbugs] [Bug 12460] New: load not folded if ShouldEmitAsBranches is true

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 4 09:31:12 PDT 2012


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

             Bug #: 12460
           Summary: load not folded if ShouldEmitAsBranches is true
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


In

%struct.cmdline_options = type { i8*, i8*, i8, i8, i8, i8 }
@g_options = global %struct.cmdline_options zeroinitializer, align 8
@foobar = global i32* null, align 8
define void @_Z11processargsv() uwtable ssp {
  %1 = load i8* getelementptr inbounds (%struct.cmdline_options* @g_options,
i64 0, i32 3), align 1, !range !0
  %2 = icmp eq i8 %1, 0
  %3 = load i8* getelementptr inbounds (%struct.cmdline_options* @g_options,
i64 0, i32 5), align 1, !range !0
  %4 = icmp eq i8 %3, 0
  %or.cond = or i1 %2, %4
  br i1 %or.cond, label %6, label %5
; <label>:5                                       ; preds = %0
  tail call void @_Z3foov()
  br label %6
; <label>:6                                       ; preds = %0, %5
  ret void
}
declare void @_Z3foov()
!0 = metadata !{i8 0, i8 2} 

We decide to split the or into multiple branches and produce

    cmpb    $0, _g_options+17(%rip)
    je    LBB0_2
    movb    _g_options+19(%rip), %al
    testb    %al, %al
    jne    LBB0_3

The first load is folded into the compare, but the second one is not.

In this particular testcase the best is probably to not split, but the issues
is more general. llc -view-isel-dags shows both loads in the first BB, so we
are probably just splitting the 'or' too late.

-- 
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