[llvm-dev] [GlobalISel] [X86] unable to legalize instruction
S. Bharadwaj Yadavalli via llvm-dev
llvm-dev at lists.llvm.org
Fri Nov 10 12:00:26 PST 2017
Thank you very much for your reply. That helped.
I spent a little bit of time debugging the failure. It appears that
X86LegalizerInfo does not (yet?) set up the required actions and tables for
the opcode G_SDIV. I have not looked at GlobalISel phase earlier, but am
curious to learn of the reasons for G_SDIV not being supported, yet. Are
there any pointers that give some background? Of course, I hope to continue
to dig irrespectively (albeit slowly :-)).
Thanks again!
Bharadwaj
On Nov 8, 2017 11:31 PM, "Breger, Igor" <igor.breger at intel.com> wrote:
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 at gmail.com]
*Sent:* Thursday, November 09, 2017 03:36
*To:* Aditya Nandakumar <proaditya at gmail.com>
*Cc:* Craig Topper <craig.topper at gmail.com>; llvm-dev <
llvm-dev at lists.llvm.org>; Breger, Igor <igor.breger at intel.com>
*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<def>(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 at 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 at 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-mirro
r/llvm.git 761e543ac73ddc55d2cf3c6892fe18eecb0c89d9)"}
On Wed, Oct 11, 2017 at 5:50 PM, Craig Topper <craig.topper at 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 at 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 <Machine-Name> 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 at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
LLVM Developers mailing list
llvm-dev at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171110/d3c22998/attachment.html>
More information about the llvm-dev
mailing list