[llvm] [SCEV] Use Step and Start to check if SCEVWrapPredicate is implied. (PR #118184)
Mikael Holmén via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 22:36:37 PST 2024
mikaelholmen wrote:
Hi @fhahn
The following starts failing with this patch:
```opt -passes="loop-vectorize" bbi-102468.ll -o /dev/null```
It fails with
```
opt: ../lib/Analysis/ScalarEvolution.cpp:1570: const SCEV *llvm::ScalarEvolution::getZeroExtendExpr(const SCEV *, Type *, unsigned int): Assertion `!Op->getType()->isPointerTy() && "Can't extend pointer!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: build-all/bin/opt -passes=loop-vectorize bbi-102468.ll -o /dev/null
1. Running pass "function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)" on module "bbi-102468.ll"
2. Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "set_i64_i16_2"
#0 0x0000560a42c30486 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (build-all/bin/opt+0x443e486)
#1 0x0000560a42c2dece llvm::sys::RunSignalHandlers() (build-all/bin/opt+0x443bece)
#2 0x0000560a42c30d39 SignalHandler(int) Signals.cpp:0:0
#3 0x00007fb0a9d24cf0 __restore_rt (/lib64/libpthread.so.0+0x12cf0)
#4 0x00007fb0a76d5acf raise (/lib64/libc.so.6+0x4eacf)
#5 0x00007fb0a76a8ea5 abort (/lib64/libc.so.6+0x21ea5)
#6 0x00007fb0a76a8d79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
#7 0x00007fb0a76ce426 (/lib64/libc.so.6+0x47426)
#8 0x0000560a4338b013 llvm::ScalarEvolution::getZeroExtendExpr(llvm::SCEV const*, llvm::Type*, unsigned int) (build-all/bin/opt+0x4b99013)
#9 0x0000560a4339e0e0 llvm::ScalarEvolution::getNoopOrZeroExtend(llvm::SCEV const*, llvm::Type*) (build-all/bin/opt+0x4bac0e0)
#10 0x0000560a433da6af llvm::SCEVWrapPredicate::implies(llvm::SCEVPredicate const*, llvm::ScalarEvolution&) const (build-all/bin/opt+0x4be86af)
#11 0x0000560a433daec4 llvm::SCEVUnionPredicate::implies(llvm::SCEVPredicate const*, llvm::ScalarEvolution&) const (build-all/bin/opt+0x4be8ec4)
#12 0x0000560a433db561 llvm::PredicatedScalarEvolution::addPredicate(llvm::SCEVPredicate const&) (build-all/bin/opt+0x4be9561)
#13 0x0000560a433dbc88 llvm::PredicatedScalarEvolution::setNoOverflow(llvm::Value*, llvm::SCEVWrapPredicate::IncrementWrapFlags) (build-all/bin/opt+0x4be9c88)
#14 0x0000560a43469eac llvm::getPtrStride(llvm::PredicatedScalarEvolution&, llvm::Type*, llvm::Value*, llvm::Loop const*, llvm::DenseMap<llvm::Value*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*, void>, llvm::detail::DenseMapPair<llvm::Value*, llvm::SCEV const*>> const&, bool, bool) (build-all/bin/opt+0x4c77eac)
#15 0x0000560a4346b498 llvm::MemoryDepChecker::getDependenceDistanceStrideAndSize(llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*>>> const&, llvm::Instruction*, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*>>> const&, llvm::Instruction*) (build-all/bin/opt+0x4c79498)
#16 0x0000560a4346be6c llvm::MemoryDepChecker::isDependent(llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*>>> const&, unsigned int, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*>>> const&, unsigned int) (build-all/bin/opt+0x4c79e6c)
#17 0x0000560a4346cfcd llvm::MemoryDepChecker::areDepsSafe(llvm::EquivalenceClasses<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*>>>, std::less<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*>>>>> const&, llvm::SmallVector<llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*>>>, 8u> const&) (build-all/bin/opt+0x4c7afcd)
#18 0x0000560a43471586 llvm::LoopAccessInfo::analyzeLoop(llvm::AAResults*, llvm::LoopInfo const*, llvm::TargetLibraryInfo const*, llvm::DominatorTree*) (build-all/bin/opt+0x4c7f586)
#19 0x0000560a4347456c llvm::LoopAccessInfo::LoopAccessInfo(llvm::Loop*, llvm::ScalarEvolution*, llvm::TargetTransformInfo const*, llvm::TargetLibraryInfo const*, llvm::AAResults*, llvm::DominatorTree*, llvm::LoopInfo*) (build-all/bin/opt+0x4c8256c)
#20 0x0000560a43474d0c llvm::LoopAccessInfoManager::getInfo(llvm::Loop&) (build-all/bin/opt+0x4c82d0c)
#21 0x0000560a44267eb1 llvm::LoopVectorizationLegality::canVectorizeMemory() (build-all/bin/opt+0x5a75eb1)
#22 0x0000560a4426b5a7 llvm::LoopVectorizationLegality::canVectorize(bool) (build-all/bin/opt+0x5a795a7)
#23 0x0000560a441d650c llvm::LoopVectorizePass::processLoop(llvm::Loop*) (build-all/bin/opt+0x59e450c)
#24 0x0000560a441de73b llvm::LoopVectorizePass::runImpl(llvm::Function&) (build-all/bin/opt+0x59ec73b)
#25 0x0000560a441deff6 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x59ecff6)
#26 0x0000560a4408a40d llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilderPipelines.cpp:0:0
#27 0x0000560a42e4f6a7 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x465d6a7)
#28 0x0000560a44081f6d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilderPipelines.cpp:0:0
#29 0x0000560a42e5427e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x466227e)
#30 0x0000560a44079a3d llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) PassBuilderPipelines.cpp:0:0
#31 0x0000560a42e4e397 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x465c397)
#32 0x0000560a44001dfc 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) (build-all/bin/opt+0x580fdfc)
#33 0x0000560a42bf30d0 optMain (build-all/bin/opt+0x44010d0)
#34 0x00007fb0a76c1d85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
#35 0x0000560a42bf0cee _start (build-all/bin/opt+0x43fecee)
Abort (core dumped)
```
[bbi-102468.ll.gz](https://github.com/user-attachments/files/18176134/bbi-102468.ll.gz)
https://github.com/llvm/llvm-project/pull/118184
More information about the llvm-commits
mailing list