[PATCH] D133891: [SLP]Improve isUndefVector function by adding insertelement analysis.

Steven Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 13:33:17 PDT 2022


srj added a comment.

OK, I finally got a failure with ASAN enabled, hopefully this will be enough to track it down:

  =================================================================
  ==349869==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60b000dd8e04 at pc 0x55c2ef8886fe bp 0x7ffdda88ecb0 sp 0x7ffdda88e470
  WRITE of size 64 at 0x60b000dd8e04 thread T0
      #0 0x55c2ef8886fd in __asan_memmove third_party/llvm/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:30:3
      #1 0x55c2f485ecdb in __copy_impl<int, int, void> third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__algorithm/copy.h:56:5
      #2 0x55c2f485ecdb in __copy<int *, int *, int *, 0> third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__algorithm/copy.h:94:18
      #3 0x55c2f485ecdb in copy<int *, int *> third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__algorithm/copy.h:103:10
      #4 0x55c2f485ecdb in copy<llvm::SmallVector<int, 12U> &, int *> third_party/llvm/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1642:10
      #5 0x55c2f485ecdb in llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6416:7
      #6 0x55c2f4869ebd in llvm::slpvectorizer::BoUpSLP::getTreeCost(llvm::ArrayRef<llvm::Value*>) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7218:25
      #7 0x55c2f488d4d2 in llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10575:32
      #8 0x55c2f4894dfc in llvm::SLPVectorizerPass::vectorizeInsertElementInst(llvm::InsertElementInst*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12031:10
      #9 0x55c2f4895456 in llvm::SLPVectorizerPass::vectorizeSimpleInstructions(llvm::SmallSetVector<llvm::Instruction*, 8u>&, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, bool) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12182:21
      #10 0x55c2f48885e4 in llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12491:21
      #11 0x55c2f4884f84 in llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10233:16
      #12 0x55c2f4884198 in llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10164:18
      #13 0x55c2f2aa37e1 in llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
      #14 0x55c2f5944276 in llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManager.h:517:40
      #15 0x55c2f16f3df1 in llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
      #16 0x55c2f5942170 in llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) third_party/llvm/llvm-project/llvm/lib/IR/PassManager.cpp:124:38
      #17 0x55c2efb948d1 in llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
      #18 0x55c2f59429e6 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManager.h:517:40
      #19 0x55c2efb2ece1 in Halide::Internal::CodeGen_LLVM::optimize_module() third_party/halide/halide/src/CodeGen_LLVM.cpp:1276:9
      #20 0x55c2efb29e39 in Halide::Internal::CodeGen_LLVM::finish_codegen() third_party/halide/halide/src/CodeGen_LLVM.cpp:587:19
      #21 0x55c2efb2b408 in Halide::Internal::CodeGen_LLVM::compile(Halide::Module const&) third_party/halide/halide/src/CodeGen_LLVM.cpp:576:12
      #22 0x55c2efb22f54 in Halide::codegen_llvm(Halide::Module const&, llvm::LLVMContext&) third_party/halide/halide/src/CodeGen_LLVM.cpp:44:16
      #23 0x55c2efe39886 in Halide::Module::compile(std::__u::map<Halide::OutputFileType, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>>, std::__u::less<Halide::OutputFileType>, std::__u::allocator<std::__u::pair<Halide::OutputFileType const, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>>>>> const&) const third_party/halide/halide/src/Module.cpp:662:51
      #24 0x55c2eff591a2 in Halide::Pipeline::compile_to_llvm_assembly(std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>> const&, std::__u::vector<Halide::Argument, std::__u::allocator<Halide::Argument>> const&, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>> const&, Halide::Target const&) third_party/halide/halide/src/Pipeline.cpp:341:7
      #25 0x55c2ef978bd8 in Halide::Func::compile_to_llvm_assembly(std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>> const&, std::__u::vector<Halide::Argument, std::__u::allocator<Halide::Argument>> const&, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>> const&, Halide::Target const&) third_party/halide/halide/src/Func.cpp:3418:16
      #26 0x55c2ef90e410 in main third_party/halide/halide/apps/fft/main.cpp:112:14
      #27 0x7fc79ef6b632 in __libc_start_main (/usr/grte/v5/lib64/libc.so.6+0x61632) (BuildId: 280088eab084c30a3992a9bce5c35b44)
      #28 0x55c2ef7ebd69 in _start /build/work/ab393f4ac612f9027aae6b1a7226027ba2a2/google3/blaze-out/k8-opt/bin/third_party/grte/v5_src/grte-scratch/BUILD/src/csu/../sysdeps/x86_64/start.S:120
  
  0x60b000dd8e04 is located 0 bytes after 100-byte region [0x60b000dd8da0,0x60b000dd8e04)
  allocated by thread T0 here:
      #0 0x55c2ef888f2e in malloc third_party/llvm/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
      #1 0x55c2f5d9bdca in safe_malloc third_party/llvm/llvm-project/llvm/include/llvm/Support/MemAlloc.h:26:18
      #2 0x55c2f5d9bdca in llvm::SmallVectorBase<unsigned int>::grow_pod(void*, unsigned long, unsigned long) third_party/llvm/llvm-project/llvm/lib/Support/SmallVector.cpp:126:15
      #3 0x55c2f0ec4d63 in grow_pod third_party/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:127:11
      #4 0x55c2f0ec4d63 in grow third_party/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:512:41
      #5 0x55c2f0ec4d63 in llvm::SmallVectorTemplateBase<int, true>::growAndAssign(unsigned long, int) third_party/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:534:11
      #6 0x55c2f485eca2 in SmallVector third_party/llvm/llvm-project/llvm/include/llvm/ADT/SmallVector.h:1194:11
      #7 0x55c2f485eca2 in llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6415:24
      #8 0x55c2f4869ebd in llvm::slpvectorizer::BoUpSLP::getTreeCost(llvm::ArrayRef<llvm::Value*>) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7218:25
      #9 0x55c2f488d4d2 in llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10575:32
      #10 0x55c2f4894dfc in llvm::SLPVectorizerPass::vectorizeInsertElementInst(llvm::InsertElementInst*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12031:10
      #11 0x55c2f4895456 in llvm::SLPVectorizerPass::vectorizeSimpleInstructions(llvm::SmallSetVector<llvm::Instruction*, 8u>&, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, bool) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12182:21
      #12 0x55c2f48885e4 in llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12491:21
      #13 0x55c2f4884f84 in llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10233:16
      #14 0x55c2f4884198 in llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) third_party/llvm/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10164:18
      #15 0x55c2f2aa37e1 in llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
      #16 0x55c2f5944276 in llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManager.h:517:40
      #17 0x55c2f16f3df1 in llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
      #18 0x55c2f5942170 in llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) third_party/llvm/llvm-project/llvm/lib/IR/PassManager.cpp:124:38
      #19 0x55c2efb948d1 in llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
      #20 0x55c2f59429e6 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) third_party/llvm/llvm-project/llvm/include/llvm/IR/PassManager.h:517:40
      #21 0x55c2efb2ece1 in Halide::Internal::CodeGen_LLVM::optimize_module() third_party/halide/halide/src/CodeGen_LLVM.cpp:1276:9
      #22 0x55c2efb29e39 in Halide::Internal::CodeGen_LLVM::finish_codegen() third_party/halide/halide/src/CodeGen_LLVM.cpp:587:19
      #23 0x55c2efb2b408 in Halide::Internal::CodeGen_LLVM::compile(Halide::Module const&) third_party/halide/halide/src/CodeGen_LLVM.cpp:576:12
      #24 0x55c2efb22f54 in Halide::codegen_llvm(Halide::Module const&, llvm::LLVMContext&) third_party/halide/halide/src/CodeGen_LLVM.cpp:44:16
      #25 0x55c2efe39886 in Halide::Module::compile(std::__u::map<Halide::OutputFileType, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>>, std::__u::less<Halide::OutputFileType>, std::__u::allocator<std::__u::pair<Halide::OutputFileType const, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>>>>> const&) const third_party/halide/halide/src/Module.cpp:662:51
      #26 0x55c2eff591a2 in Halide::Pipeline::compile_to_llvm_assembly(std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>> const&, std::__u::vector<Halide::Argument, std::__u::allocator<Halide::Argument>> const&, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>> const&, Halide::Target const&) third_party/halide/halide/src/Pipeline.cpp:341:7
      #27 0x55c2ef978bd8 in Halide::Func::compile_to_llvm_assembly(std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>> const&, std::__u::vector<Halide::Argument, std::__u::allocator<Halide::Argument>> const&, std::__u::basic_string<char, std::__u::char_traits<char>, std::__u::allocator<char>> const&, Halide::Target const&) third_party/halide/halide/src/Func.cpp:3418:16
      #28 0x55c2ef90e410 in main third_party/halide/halide/apps/fft/main.cpp:112:14
      #29 0x7fc79ef6b632 in __libc_start_main (/usr/grte/v5/lib64/libc.so.6+0x61632) (BuildId: 280088eab084c30a3992a9bce5c35b44)
      #30 0x55c2ef7ebd69 in _start /build/work/ab393f4ac612f9027aae6b1a7226027ba2a2/google3/blaze-out/k8-opt/bin/third_party/grte/v5_src/grte-scratch/BUILD/src/csu/../sysdeps/x86_64/start.S:120
  
  SUMMARY: AddressSanitizer: heap-buffer-overflow third_party/llvm/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:30:3 in __asan_memmove
  Shadow bytes around the buggy address:
    0x0c16801b3170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    0x0c16801b3180: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
    0x0c16801b3190: 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa fa
    0x0c16801b31a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    0x0c16801b31b0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
  =>0x0c16801b31c0:[04]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    0x0c16801b31d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    0x0c16801b31e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa
    0x0c16801b31f0: fa fa fa fa fa fa 00 00 00 00 00 00 00 00 00 00
    0x0c16801b3200: 00 00 04 fa fa fa fa fa fa fa fa fa fa fa fa fa
    0x0c16801b3210: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  Shadow byte legend (one shadow byte represents 8 application bytes):
    Addressable:           00
    Partially addressable: 01 02 03 04 05 06 07 
    Heap left redzone:       fa
    Freed heap region:       fd
    Stack left redzone:      f1
    Stack mid redzone:       f2
    Stack right redzone:     f3
    Stack after return:      f5
    Stack use after scope:   f8
    Global redzone:          f9
    Global init order:       f6
    Poisoned by user:        f7
    Container overflow:      fc
    Array cookie:            ac
    Intra object redzone:    bb
    ASan internal:           fe
    Left alloca redzone:     ca
    Right alloca redzone:    cb
  ==349869==ABORTING


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133891/new/

https://reviews.llvm.org/D133891



More information about the llvm-commits mailing list