S. Bharadwaj Yadavalli via llvm-dev
2017-Oct-12 01:44 UTC
[llvm-dev] [GlobalISel] [X86] unable to legalize instruction
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 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 >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171011/6fb0bf98/attachment.html>
Aditya Nandakumar via llvm-dev
2017-Oct-12 03:13 UTC
[llvm-dev] [GlobalISel] [X86] unable to legalize instruction
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-mirror/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-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171011/8acb52b3/attachment.html>
S. Bharadwaj Yadavalli via llvm-dev
2017-Nov-09 01:36 UTC
[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 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171108/e45dc554/attachment.html>