Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FastISel causes assertion "i8 shifts should be handled by autogenerated table" #36079

Closed
vchuravy opened this issue Mar 14, 2018 · 9 comments
Closed
Assignees
Labels
backend:X86 bugzilla Issues migrated from bugzilla

Comments

@vchuravy
Copy link
Contributor

Bugzilla Link 36731
Resolution FIXED
Resolved on May 08, 2018 15:21
Version 6.0
OS Linux
Blocks #35997
Attachments Reduced input file
CC @topperc,@RKSimon,@tstellar
Fixed by commit(s) r327540 r331815

Extended Description

I am currently looking into upgrading the Julia frontend to use LLVM 6.0
With FastISel on I run into the assertion:

I->getType()->isIntegerTy(8) && "i8 shifts should be handled by autogenerated table"' failed.

I reduced dumped the module with bugpoint to the attached input file, which triggers the assertion with llc -fast-isel bugpoint.ll.

usr/tools/llc -fast-isel ~/bugpoint.ll 
llc: /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/Target/X86/X86FastISel.cpp:1793: bool {anonymous}::X86FastISel::X86SelectShift(const llvm::Instruction*): Assertion `!I->getType()->isIntegerTy(8) && "i8 shifts should be handled by autogenerated table"' failed.
#​0 0x00007f77a964940a llvm::sys::PrintStackTrace(llvm::raw_ostream&) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/Support/Unix/Signals.inc:402:0
#​1 0x00007f77a964720e llvm::sys::RunSignalHandlers() /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/Support/Signals.cpp:50:0
#​2 0x00007f77a9647382 SignalHandler(int) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/Support/Unix/Signals.inc:242:0
#​3 0x00007f77a877b4b0 (/lib/x86_64-linux-gnu/libc.so.6+0x354b0)
#​4 0x00007f77a877b428 gsignal /build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#​5 0x00007f77a877d02a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
#​6 0x00007f77a8773bd7 __assert_fail_base /build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0
#​7 0x00007f77a8773c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#​8 0x00007f77aab571e9 llvm::MachineRegisterInfo::getRegClass(unsigned int) const /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/include/llvm/CodeGen/MachineRegisterInfo.h:602:0
#​9 0x00007f77aab571e9 X86FastEmitPseudoSelect /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/Target/X86/X86FastISel.cpp:2326:0
#​10 0x00007f77aab571e9 X86SelectSelect /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/Target/X86/X86FastISel.cpp:2400:0
#​11 0x00007f77aab571e9 (anonymous namespace)::X86FastISel::fastSelectInstruction(llvm::Instruction const*) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/Target/X86/X86FastISel.cpp:3596:0
#​12 0x00007f77a9b8df08 llvm::FastISel::selectInstruction(llvm::Instruction const*) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/CodeGen/SelectionDAG/FastISel.cpp:1437:0
#​13 0x00007f77a9ce1a1c llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1505:0
#​14 0x00007f77a9ce3f25 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone .part.881] [clone .constprop.905] /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:467:0
#​15 0x00007f77aab91fb4 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/Target/X86/X86ISelDAGToDAG.cpp:177:0
#​16 0x00007f77a99267d5 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/CodeGen/MachineFunctionPass.cpp:62:0
#​17 0x00007f77a974409b llvm::FPPassManager::runOnFunction(llvm::Function&) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/IR/LegacyPassManager.cpp:1520:0
#​18 0x00007f77a974415c llvm::FPPassManager::runOnModule(llvm::Module&) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/IR/LegacyPassManager.cpp:1541:0
#​19 0x00007f77a9743c9d llvm::legacy::PassManagerImpl::run(llvm::Module&) /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/lib/IR/LegacyPassManager.cpp:1597:0
#​20 0x0000000000418e5d compileModule(char**, llvm::LLVMContext&) [clone .constprop.391] /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/tools/llc/llc.cpp:572:0
#​21 0x000000000040bc2d main /builds/vchuravy/julia/deps/srccache/llvm-6.0.0/tools/llc/llc.cpp:346:0
#​22 0x00007f77a8766830 __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0
#​23 0x000000000040bde9 _start (usr/tools/llc+0x40bde9)
Stack dump:
0.	Program arguments: usr/tools/llc -fast-isel /afs/csail.mit.edu/u/v/vchuravy/bugpoint.ll 
1.	Running pass 'Function Pass Manager' on module '/afs/csail.mit.edu/u/v/vchuravy/bugpoint.ll'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@julia_bin_5346'
@vchuravy
Copy link
Contributor Author

assigned to @topperc

@topperc
Copy link
Collaborator

topperc commented Mar 14, 2018

This was caused by r316797 when I removed what I thought was dead code. But it turns out its not dead if the shift amount is out of bounds. The test case here shows a shift amount of -1.

Any idea where this shift amount came from?

@topperc
Copy link
Collaborator

topperc commented Mar 14, 2018

Reverted with a test case in r327540.

@vchuravy
Copy link
Contributor Author

@vchuravy
Copy link
Contributor Author

Thanks Craig for the quick fix!

Any idea where this shift amount came from?

The original Julia code that this is from ishttps://github.com/JuliaLang/julia/blob/71ef5a03987030c0b675f3e973cb6d64c8b22bb2/base/intfuncs.jl#L569-L579 and I attached IR Julia generates.

If you want I can probably try and get you the LLVM IR after all the Julia specific LLVM passes and the opt pipeline have run, since the IR right now is contains Julia specific stuff.

@vchuravy
Copy link
Contributor Author

vchuravy commented May 8, 2018

Reopened for inclusion in 6.0.1

https://reviews.llvm.org/rL327540

@tstellar
Copy link
Collaborator

tstellar commented May 8, 2018

Hi Craig,

Is this OK to merge to the release_60 branch?

@topperc
Copy link
Collaborator

topperc commented May 8, 2018

Yes its ok to merge. Thanks!

@tstellar
Copy link
Collaborator

tstellar commented May 8, 2018

Merged: r331815

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

3 participants