[llvm] [LoopVectorizer] Add support for chaining partial reductions (PR #120272)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 12:30:54 PST 2025


vitalybuka wrote:

CC @thurstond 

https://lab.llvm.org/buildbot/#/builders/24/builds/4540/steps/12/logs/stdio
```
==opt==1722165==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xf6184b80d4a8 at pc 0xb1cd42d8a71c bp 0xfffff44c2250 sp 0xfffff44c2248
READ of size 8 at 0xf6184b80d4a8 thread T0
    #0 0xb1cd42d8a718 in llvm::VPRecipeBuilder::getScaledReduction(llvm::Instruction*, llvm::Instruction*, llvm::VFRange&) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8749:34
    #1 0xb1cd42d892a4 in llvm::VPRecipeBuilder::collectScaledReductions(llvm::VFRange&) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8688:19
    #2 0xb1cd42d8d718 in llvm::LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(llvm::VFRange&) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9315:17
    #3 0xb1cd42d6ea28 in llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8907:21
    #4 0xb1cd42d6dc20 in llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7163:3
    #5 0xb1cd42d9f998 in llvm::LoopVectorizePass::processLoop(llvm::Loop*) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10537:7
    #6 0xb1cd42dadf7c in llvm::LoopVectorizePass::runImpl(llvm::Function&) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10817:30
    #7 0xb1cd42daf0d4 in llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10854:32
    #8 0xb1cd40013408 in llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
    #9 0xb1cd4001f3a8 in llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/lib/IR/PassManager.cpp:124:38
    #10 0xb1cd40010834 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81:38
    #11 0xb1cd429e4d64 in 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::__1::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/tools/opt/NewPMDriver.cpp:541:7
    #12 0xb1cd3fadb7e4 in optMain /home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm-project/llvm/tools/opt/optdriver.cpp:739:12
    #13 0xfa184d9684c0  (/lib/aarch64-linux-gnu/libc.so.6+0x284c0) (BuildId: 32fa4d6f3a8d5f430bdb7af2eb779470cd5ec7c2)
    #14 0xfa184d968594 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x28594) (BuildId: 32fa4d6f3a8d5f430bdb7af2eb779470cd5ec7c2)
    #15 0xb1cd3f9e8a6c in _start (/home/b/sanitizer-aarch64-linux-bootstrap-asan/build/llvm_build_asan/bin/opt+0x8b38a6c)
```

https://github.com/llvm/llvm-project/pull/120272


More information about the llvm-commits mailing list