[LLVMbugs] [Bug 12247] New: Instruction select selects assembly before idiv

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 11 20:34:10 PDT 2012


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

             Bug #: 12247
           Summary: Instruction select selects assembly before idiv
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: Pidgeot18 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8190
  --> http://llvm.org/bugs/attachment.cgi?id=8190
IR that demonstrates the case

It seems that, sometimes, it is possible for the instruction selection code to
select IR statements prior to an inline ASM construct into machine instructions
that come later. In short:

%rem957 = srem i32 %joinphi43, 0
%rem968 = srem i32 %rem957, 4096
%mul979 = shl nsw i32 %rem968, 2
%idxprom9810 = sext i32 %mul979 to i64
%0 = call i8 asm sideeffect "after idiv", "={ax},~{dirflag},~{fpsr},~{flags}"()

Ends up turning into:
INLINEASM <es:after idiv> [sideeffect], $0:[regdef], %AL<imp-def>,
$1:[clobber], %EFLAGS<earlyclobber,imp-def>, <<badref>>
%vreg11<def> = COPY %AL; GR8:%vreg11
%vreg12<def> = MOVSX64rr8 %vreg11; GR64:%vreg12 GR8:%vreg11
ADJCALLSTACKDOWN64 0, %RSP<imp-def,dead>, %EFLAGS<imp-def,dead>, %RSP<imp-use>
%vreg13<def> = MOV64r0 %EFLAGS<imp-def,dead>; GR64:%vreg13
%vreg14<def> = DEC64_32r %vreg9, %EFLAGS<imp-def,dead>; GR32:%vreg14,%vreg9
%EAX<def> = COPY %vreg14; GR32:%vreg14
CDQ %EAX<imp-def>, %EDX<imp-def>, %EAX<imp-use>
IDIV32r %vreg10, %EAX<imp-def,dead>, %EDX<imp-def>, %EFLAGS<imp-def,dead>,
%EAX<imp-use>, %EDX<imp-use>; GR32:%vreg10

A full .ll test case is provided, which has been passed through bugpoint,
although there are probably smaller testcases that can still trigger this bug.
Note that the output .s file won't compile, as it's meant to illustrate that
the asm is being selected too early.

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