Issue 176663
Summary [LoopVectorize] Assertion `isValidElementType(ElementType) && "Element type of a VectorType must be an integer..."' failed.
Labels vectorizers, crash-on-valid, generated by fuzzer
Assignees
Reporter dtcxzyw
    Reproducer: https://godbolt.org/z/o835nTqE6
```
; bin/opt -passes=loop-vectorize test.ll -S
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define i32 @main() {
entry:
  br label %for.cond579.preheader.i.i.i

for.cond579.preheader.i.i.i: ; preds = %for.cond579.preheader.i.i.i, %entry
 %indvars.iv.i212.i.i = phi i64 [ 0, %entry ], [ %indvars.iv.next.i213.i.i, %for.cond579.preheader.i.i.i ]
  %or603707708.i.i.i = phi i32 [ 0, %entry ], [ %or603.i.i.i, %for.cond579.preheader.i.i.i ]
  %0 = tail call { i32, i1 } @llvm.smul.with.overflow.i32(i32 0, i32 0)
  %1 = extractvalue { i32, i1 } %0, 1
  %conv.i.i.i.i = zext i1 %1 to i32
  %or603.i.i.i = or i32 %or603707708.i.i.i, %conv.i.i.i.i
  %indvars.iv.next.i213.i.i = add i64 %indvars.iv.i212.i.i, 1
  %exitcond.not.i214.i.i = icmp eq i64 %indvars.iv.i212.i.i, 1
  br i1 %exitcond.not.i214.i.i, label %for.end606.i.i.i, label %for.cond579.preheader.i.i.i

for.end606.i.i.i: ; preds = %for.cond579.preheader.i.i.i
  ret i32 %or603.i.i.i
}

```
```
opt: /root/llvm-project/llvm/lib/IR/Type.cpp:804: static llvm::FixedVectorType* llvm::FixedVectorType::get(llvm::Type*, unsigned int): Assertion `isValidElementType(ElementType) && "Element type of a VectorType must " "be an integer, floating point, " "pointer type, or a valid target " "extension type."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=loop-vectorize <source>
1.	Running pass "function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)" on module "<source>"
2.	Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "main"
 #0 0x0000000005a776e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a776e8)
 #1 0x0000000005a745c4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000705354e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x0000705354e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x0000705354e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x0000705354e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000705354e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x0000705354e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x00000000058119c7 llvm::FixedVectorType::get(llvm::Type*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x58119c7)
 #9 0x000000000573bac7 llvm::IRBuilderBase::CreateVectorSplat(llvm::ElementCount, llvm::Value*, llvm::Twine const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x573bac7)
#10 0x00000000038b2790 llvm::VPTransformState::get(llvm::VPValue const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x38b2790)
#11 0x000000000390d097 llvm::VPWidenRecipe::execute(llvm::VPTransformState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x390d097)
#12 0x00000000038adb73 llvm::VPBasicBlock::executeRecipes(llvm::VPTransformState*, llvm::BasicBlock*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x38adb73)
#13 0x00000000038c41c5 llvm::VPBasicBlock::execute(llvm::VPTransformState*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x38c41c5)
#14 0x00000000038c96e2 llvm::VPlan::execute(llvm::VPTransformState*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x38c96e2)
#15 0x0000000003730b13 llvm::LoopVectorizationPlanner::executePlan(llvm::ElementCount, unsigned int, llvm::VPlan&, llvm::InnerLoopVectorizer&, llvm::DominatorTree*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3730b13)
#16 0x000000000374a448 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x374a448)
#17 0x000000000374ca50 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x374ca50)
#18 0x000000000374d1dd llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x374d1dd)
#19 0x000000000302301e llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x302301e)
#20 0x00000000057eb4e1 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57eb4e1)
#21 0x0000000000f07e1e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf07e1e)
#22 0x00000000057e9a9a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57e9a9a)
#23 0x000000000096469e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96469e)
#24 0x00000000057e9451 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57e9451)
#25 0x000000000096e85a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96e85a)
#26 0x0000000000962908 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x962908)
#27 0x0000705354e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#28 0x0000705354e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#29 0x0000000000959585 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x959585)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```

Similar to https://github.com/llvm/llvm-project/issues/176548, it may be caused by recent changes allowing the vectorization of overflow intrinsics: https://github.com/llvm/llvm-project/pull/174835

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to