[llvm-bugs] [Bug 31778] New: Vectorization interacts badly with ARM division lowering

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 26 15:08:37 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31778

            Bug ID: 31778
           Summary: Vectorization interacts badly with ARM division
                    lowering
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: ARM
          Assignee: compnerd at compnerd.org
          Reporter: smeenai at fb.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

% cat /tmp/crash.c
void apply(short *a, short *b, int c) {
  while (c--) {
    *b = *a / 3;
    b++;
  }
}

% /path/to/llvm/build/bin/clang-5.0 -cc1 -triple thumbv7--windows-msvc18.0.0
-emit-obj -O1 -vectorize-loops -o /dev/null /tmp/crash.c
clang-5.0: ../../../lib/Target/ARM/ARMISelLowering.cpp:7342: llvm::SDValue
llvm::ARMTargetLowering::LowerDIV_Windows(llvm::SDValue, llvm::SelectionDAG&,
bool) const: Assertion `Op.getValueType() == MVT::i32 && "unexpected type for
custom lowering DIV"' failed.
0  clang-5.0       0x00000000015eed95
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  clang-5.0       0x00000000015ece0e llvm::sys::RunSignalHandlers() + 62
2  clang-5.0       0x00000000015ecf72
3  libpthread.so.0 0x00007fe8f91c2370
4  libc.so.6       0x00007fe8f7fe41d7 gsignal + 55
5  libc.so.6       0x00007fe8f7fe58c8 abort + 328
6  libc.so.6       0x00007fe8f7fdd146
7  libc.so.6       0x00007fe8f7fdd1f2
8  clang-5.0       0x0000000000aee7bf
llvm::ARMTargetLowering::LowerDIV_Windows(llvm::SDValue, llvm::SelectionDAG&,
bool) const + 79
9  clang-5.0       0x0000000000b090a8
llvm::ARMTargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&)
const + 6376
10 clang-5.0       0x0000000001d00d43
11 clang-5.0       0x0000000001d02c9f llvm::SelectionDAG::LegalizeVectors() +
367
12 clang-5.0       0x0000000001cbdfd9
llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 729
13 clang-5.0       0x0000000001cc6544
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1604
14 clang-5.0       0x0000000001cc85ac
15 clang-5.0       0x0000000000abcad4
16 clang-5.0       0x0000000000f54c43
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 355
17 clang-5.0       0x0000000001233bd3
llvm::FPPassManager::runOnFunction(llvm::Function&) + 643
18 clang-5.0       0x0000000001233c7c
llvm::FPPassManager::runOnModule(llvm::Module&) + 60
19 clang-5.0       0x00000000012344df
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 735
20 clang-5.0       0x000000000176056c
21 clang-5.0       0x0000000001761780
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions
const&, clang::CodeGenOptions const&, clang::TargetOptions const&,
clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*,
clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) + 832
22 clang-5.0       0x0000000001d8450c
23 clang-5.0       0x0000000002195b62 clang::ParseAST(clang::Sema&, bool, bool)
+ 578
24 clang-5.0       0x0000000001d8272a clang::CodeGenAction::ExecuteAction() +
58
25 clang-5.0       0x0000000001a97b36 clang::FrontendAction::Execute() + 518
26 clang-5.0       0x0000000001a72796
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 358
27 clang-5.0       0x0000000001b22934
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1716
28 clang-5.0       0x0000000000a1bbd8 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 2168
29 clang-5.0       0x00000000009de5f6 main + 5510
30 libc.so.6       0x00007fe8f7fd0b35 __libc_start_main + 245
31 clang-5.0       0x0000000000a17729
Stack dump:
0.    Program arguments: /path/to/llvm/build/bin/clang-5.0 -cc1 -triple
thumbv7--windows-msvc18.0.0 -emit-obj -O1 -vectorize-loops -o /dev/null
/tmp/crash.c
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module '/tmp/crash.c'.
4.    Running pass 'ARM Instruction Selection' on function '@apply'


Removing `-vectorize-loops` fixes the crash. In particular, the problematic IR
instruction appears to be

sdiv <4 x i16> %2, <i16 3, i16 3, i16 3, i16 3>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170126/c5b80ada/attachment.html>


More information about the llvm-bugs mailing list