[LLVMbugs] [Bug 21480] New: SROA asserts with "Cannot have vector types of different sizes!"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 4 10:42:03 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21480

            Bug ID: 21480
           Summary: SROA asserts with "Cannot have vector types of
                    different sizes!"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: fraser at codeplay.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I get the following assert in SROA:

/home/fraser/llvm-trunk/llvm/lib/Transforms/Scalar/SROA.cpp:1746:
isVectorPromotionViable(const llvm::DataLayout&, llvm::Type*, uint64_t,
uint64_t, {anonymous}::AllocaSlices::const_range,
llvm::ArrayRef<{anonymous}::Slice*>)::<lambda(llvm::VectorType*,
llvm::VectorType*)>: Assertion `DL.getTypeSizeInBits(RHSTy) ==
DL.getTypeSizeInBits(LHSTy) && "Cannot have vector types of different sizes!"'
failed.

I'm compiling the IR snippet below with the following command:

clang -cc1 -O3 -emit-llvm-bc -o test.bc test.ll

=== test.ll ===
define <3 x float> @uint3_as_float3(<3 x i32> %x) #0 {
entry:
  %x.addr = alloca <3 x i32>, align 16
  %extractVec = shufflevector <3 x i32> %x, <3 x i32> undef, <4 x i32> <i32 0,
i32 1, i32 2, i32 undef>
  %storetmp = bitcast <3 x i32>* %x.addr to <4 x i32>*
  store <4 x i32> %extractVec, <4 x i32>* %storetmp, align 16
  %0 = bitcast <3 x i32>* %x.addr to <3 x float>*
  %castToVec4 = bitcast <3 x float>* %0 to <4 x float>*
  %loadVec4 = load <4 x float>* %castToVec4
  %extractVec1 = shufflevector <4 x float> %loadVec4, <4 x float> undef, <3 x
i32> <i32 0, i32 1, i32 2>
  ret <3 x float> %extractVec1
}


RHSTy is <4 x i32> and LHSTy is <3 x i32>

The full crash backtrace is attached here:

clang-3.5: /home/fraser/llvm-trunk/llvm/lib/Transforms/Scalar/SROA.cpp:1746:
isVectorPromotionViable(const llvm::DataLayout&, llvm::Type*, uint64_t,
uint64_t, {anonymous}::AllocaSlices::const_range,
llvm::ArrayRef<{anonymous}::Slice*>)::<lambda(llvm::VectorType*,
llvm::VectorType*)>: Assertion `DL.getTypeSizeInBits(RHSTy) ==
DL.getTypeSizeInBits(LHSTy) && "Cannot have vector types of different sizes!"'
failed.
#0 0x959123e llvm::sys::PrintStackTrace(_IO_FILE*)
/home/fraser/llvm-trunk/llvm/lib/Support/Unix/Signals.inc:423:0
#1 0x959147e PrintStackTraceSignalHandler(void*)
/home/fraser/llvm-trunk/llvm/lib/Support/Unix/Signals.inc:480:0
#2 0x9590223 SignalHandler(int)
/home/fraser/llvm-trunk/llvm/lib/Support/Unix/Signals.inc:199:0
#3 0xf7717cc0 (linux-gate.so.1+0xcc0)
#4 0xf7717cf0 (linux-gate.so.1+0xcf0)
#5 0xf7350f37 __GI_raise (/usr/lib32/libc.so.6+0x2bf37)
#6 0xf7352579 __GI_abort (/usr/lib32/libc.so.6+0x2d579)
#7 0xf734a007 __assert_fail_base (/usr/lib32/libc.so.6+0x25007)
#8 0xf734a08b (/usr/lib32/libc.so.6+0x2508b)
#9 0x9d02797 isVectorPromotionViable(llvm::DataLayout const&, llvm::Type*,
unsigned long long, unsigned long long, llvm::iterator_range<(anonymous
namespace)::Slice const*>, llvm::ArrayRef<(anonymous
namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}::operator()(llvm::VectorType*, llvm::VectorType*) const
/home/fraser/llvm-trunk/llvm/lib/Transforms/Scalar/SROA.cpp:1747:0
#10 0x9d137f2 bool
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>::operator()<llvm::VectorType**,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>::operator()>(llvm::VectorType**,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>::operator())
/usr/include/c++/4.9.1/bits/predefined_ops.h:121:0
#11 0x9d15c6d void std::__insertion_sort<llvm::VectorType**,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}> >(llvm::VectorType**,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>) /usr/include/c++/4.9.1/bits/stl_algo.h:1846:0
#12 0x9d13779 void std::__final_insertion_sort<llvm::VectorType**,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}> >(llvm::VectorType**,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>) /usr/include/c++/4.9.1/bits/stl_algo.h:1889:0
#13 0x9d10bc1 void std::__sort<llvm::VectorType**,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}> >(llvm::VectorType**,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>,
__gnu_cxx::__ops::_Iter_comp_iter<isVectorPromotionViable(llvm::DataLayout
const&, llvm::Type*, unsigned long long, unsigned long long,
llvm::iterator_range<(anonymous namespace)::Slice const*>,
llvm::ArrayRef<(anonymous namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>) /usr/include/c++/4.9.1/bits/stl_algo.h:1970:0
#14 0x9d0e0a8 void std::sort<llvm::VectorType**,
isVectorPromotionViable(llvm::DataLayout const&, llvm::Type*, unsigned long
long, unsigned long long, llvm::iterator_range<(anonymous namespace)::Slice
const*>, llvm::ArrayRef<(anonymous
namespace)::Slice*>)::{lambda(llvm::VectorType*,
llvm::VectorType*)#3}>(llvm::VectorType**,
isVectorPromotionViable(llvm::DataLayout const&, llvm::Type*, unsigned long
long, unsigned long long, llvm::iterator_range<(anonymous namespace)::Slice
const*>, llvm::ArrayRef<(anonymous
namespace)::Slice*>)::{lambda(llvm::VectorType*, llvm::VectorType*)#3},
isVectorPromotionViable(llvm::DataLayout const&, llvm::Type*, unsigned long
long, unsigned long long, llvm::iterator_range<(anonymous namespace)::Slice
const*>, llvm::ArrayRef<(anonymous
namespace)::Slice*>)::{lambda(llvm::VectorType*, llvm::VectorType*)#3})
/usr/include/c++/4.9.1/bits/stl_algo.h:4707:0
#15 0x9d02cd9 isVectorPromotionViable(llvm::DataLayout const&, llvm::Type*,
unsigned long long, unsigned long long, llvm::iterator_range<(anonymous
namespace)::Slice const*>, llvm::ArrayRef<(anonymous namespace)::Slice*>)
/home/fraser/llvm-trunk/llvm/lib/Transforms/Scalar/SROA.cpp:1753:0
#16 0x9d0a285 (anonymous namespace)::SROA::rewritePartition(llvm::AllocaInst&,
(anonymous namespace)::AllocaSlices&, (anonymous namespace)::Slice*, (anonymous
namespace)::Slice*, long long, long long, llvm::ArrayRef<(anonymous
namespace)::Slice*>)
/home/fraser/llvm-trunk/llvm/lib/Transforms/Scalar/SROA.cpp:3217:0
#17 0x9d0b1bb (anonymous namespace)::SROA::splitAlloca(llvm::AllocaInst&,
(anonymous namespace)::AllocaSlices&)
/home/fraser/llvm-trunk/llvm/lib/Transforms/Scalar/SROA.cpp:3412:0
#18 0x9d0b9ff (anonymous namespace)::SROA::runOnAlloca(llvm::AllocaInst&)
/home/fraser/llvm-trunk/llvm/lib/Transforms/Scalar/SROA.cpp:3542:0
#19 0x9d0c6cf (anonymous namespace)::SROA::runOnFunction(llvm::Function&)
/home/fraser/llvm-trunk/llvm/lib/Transforms/Scalar/SROA.cpp:3708:0
#20 0x9247792 llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/fraser/llvm-trunk/llvm/lib/IR/LegacyPassManager.cpp:1541:0
#21 0x9247511 llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&)
/home/fraser/llvm-trunk/llvm/lib/IR/LegacyPassManager.cpp:1490:0
#22 0x924710d llvm::legacy::FunctionPassManager::run(llvm::Function&)
/home/fraser/llvm-trunk/llvm/lib/IR/LegacyPassManager.cpp:1408:0
#23 0x9a7a03c (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
llvm::raw_ostream*)
/home/fraser/llvm-trunk/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:586:0
#24 0x9a7a19e clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_ostream*)
/home/fraser/llvm-trunk/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:609:0
#25 0x9a639e9 clang::CodeGenAction::ExecuteAction()
/home/fraser/llvm-trunk/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:723:0
#26 0x976bf45 clang::FrontendAction::Execute()
/home/fraser/llvm-trunk/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:428:0
#27 0x9735640 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/fraser/llvm-trunk/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:801:0
#28 0x9871d0e clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/fraser/llvm-trunk/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222:0
#29 0x8bc6181 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
/home/fraser/llvm-trunk/llvm/tools/clang/tools/driver/cc1_main.cpp:110:0
#30 0x8bbe769 ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef)
/home/fraser/llvm-trunk/llvm/tools/clang/tools/driver/driver.cpp:371:0
#31 0x8bbed11 main
/home/fraser/llvm-trunk/llvm/tools/clang/tools/driver/driver.cpp:417:0
#32 0xf733ce5e __libc_start_main (/usr/lib32/libc.so.6+0x17e5e)
#33 0x8bbbb31 _start (/home/fraser/llvm-trunk/build/bin/clang-3.5+0x8bbbb31)
Stack dump:
0.      Program arguments: /home/fraser/llvm-trunk/build/bin/clang-3.5 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
test.ll -mrelocation-model static -mthread-model posix -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -momit-leaf-frame-pointer -dwarf-column-info -resource-dir
/home/fraser/llvm-trunk/build/bin/../lib/clang/3.6.0 -O3
-fdebug-compilation-dir /home/fraser -ferror-limit 19 -fmessage-length 135
-mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -o /tmp/test-b90a0f.o -x ir test.ll 
1.      Per-function optimization
2.      Running pass 'SROA' on function '@uint3_as_float3'

-- 
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/20141104/cc85917e/attachment.html>


More information about the llvm-bugs mailing list