(original) (raw)

Hi ,

Currently GobalIsel like FastIsel designed to use fallback to DAGIsel in case of failure.

You can use -global-isel-abort=2 option.

llc -global-isel -pass-remarks-missed="gisel-\*" -global-isel-abort=2 simple\_foo.ll

Regards,

Igor

From: S. Bharadwaj Yadavalli \[mailto:bharadwajy@gmail.com\]
Sent: Thursday, November 09, 2017 03:36
To: Aditya Nandakumar
Cc: Craig Topper ; llvm-dev ; Breger, Igor
Subject: Re: \[llvm-dev\] \[GlobalISel\] \[X86\] unable to legalize instruction

Sorry for the late follow-up.

Here is the output with the suggested option:

$ llc -global-isel -pass-remarks-missed="gisel-\*" simple\_foo.ll

LLVM ERROR: unable to legalize instruction: %vreg17(s32) = G\_SDIV %vreg15, %vreg16; (in function: foo)

Thanks for any help/suggestions.

On Wed, Oct 11, 2017 at 8:13 PM, Aditya Nandakumar <proaditya@gmail.com> wrote:

I believe if you pass(iirc) -pass-remarks-missed=“gisel-\*”, it’ll print the instruction it failed to legalize.

Sent from my iPhone


On Oct 11, 2017, at 6:44 PM, S. Bharadwaj Yadavalli via llvm-dev <llvm-dev@lists.llvm.org> wrote:

Thanks for your quick reply.

Here its is:

===========

; ModuleID = 'simple\_foo.c'

source\_filename = "simple\_foo.c"

target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

target triple = "x86\_64-apple-macosx10.13.0"

; Function Attrs: noinline nounwind optnone ssp uwtable

define i32 @foo(i32 %a, i32 %b, i32 %c) #0 {

entry:

%retval = alloca i32, align 4

%a.addr = alloca i32, align 4

%b.addr = alloca i32, align 4

%c.addr = alloca i32, align 4

%sum = alloca i32, align 4

%sum1 = alloca i32, align 4

store i32 %a, i32\* %a.addr, align 4

store i32 %b, i32\* %b.addr, align 4

store i32 %c, i32\* %c.addr, align 4

%0 = load i32, i32\* %c.addr, align 4

%cmp = icmp ne i32 %0, 0

br i1 %cmp, label %if.then, label %if.else

if.then: ; preds = %entry

%1 = load i32, i32\* %a.addr, align 4

%2 = load i32, i32\* %b.addr, align 4

%add = add nsw i32 %1, %2

store i32 %add, i32\* %sum, align 4

%3 = load i32, i32\* %sum, align 4

%4 = load i32, i32\* %c.addr, align 4

%div = sdiv i32 %3, %4

store i32 %div, i32\* %retval, align 4

br label %return

if.else: ; preds = %entry

%5 = load i32, i32\* %a.addr, align 4

%6 = load i32, i32\* %b.addr, align 4

%add2 = add nsw i32 %5, %6

store i32 %add2, i32\* %sum1, align 4

%7 = load i32, i32\* %sum1, align 4

store i32 %7, i32\* %retval, align 4

br label %return

return: ; preds = %if.else, %if.then

%8 = load i32, i32\* %retval, align 4

ret i32 %8

}

attributes #0 = { noinline nounwind optnone ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }

!llvm.module.flags = !{!0, !1}

!llvm.ident = !{!2}

!0 = !{i32 1, !"wchar\_size", i32 4}

!1 = !{i32 7, !"PIC Level", i32 2}

!2 = !{!"clang version 6.0.0 (https://github.com/llvm-mirror/clang.git 9563977e8bce81b1dd88ce7579e36a055e3ff90b) (https://github.com/llvm-mirror/llvm.git 761e543ac73ddc55d2cf3c6892fe18eecb0c89d9)"}

On Wed, Oct 11, 2017 at 5:50 PM, Craig Topper <craig.topper@gmail.com> wrote:

global-isel for x86 is still very much a work in progress. What was the content for simple\_foo.ll?


\~Craig

On Wed, Oct 11, 2017 at 5:39 PM, S. Bharadwaj Yadavalli via llvm-dev <llvm-dev@lists.llvm.org> wrote:

Hi,

Can someone please let me know if I can expect GlobalISel to be functional for x86/x86-64 targets?

$ uname -a

Darwin 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46\~2/RELEASE\_X86\_64 x86\_64

Following is the command I used that resulted in an error :

\~/github/build/llvm/Debug/bin/llc -global-isel -O0 simple\_foo.ll

LLVM ERROR: unable to legalize instruction (in function: foo)

llc without the -global-isel option works fine.

I built clang/llc using the sources with the following tips:

LLVM

761e543ac73 (HEAD \-> master, origin/master, origin/HEAD) \[Transforms\] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

clang

9563977e8b (HEAD \-> master, origin/master, origin/HEAD) \[X86\] Add support for 'amdfam17h' to \_\_builtin\_cpu\_is to match gcc.

Thanks,

Bharadwaj

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
LLVM Developers mailing list
llvm-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
LLVM Developers mailing list
llvm-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.