This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Generalize cost model.
ClosedPublic

Authored by ABataev on Dec 14 2021, 1:13 PM.

Details

Summary

Generalized the cost model estimation. Improved cost model estimation
for repeated scalars (no need to count their cost anymore), improved

cost model for extractelement instructions.

cpu2017

511.povray_r             0.57
520.omnetpp_r           -0.98
521.wrf_r               -0.01
525.x264_r               3.59 <+
526.blender_r           -0.12
531.deepsjeng_r         -0.07
538.imagick_r           -1.42

Geometric mean: 0.21

Diff Detail

Event Timeline

ABataev created this revision.Dec 14 2021, 1:13 PM
ABataev requested review of this revision.Dec 14 2021, 1:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2021, 1:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2022, 9:07 AM
Herald added a subscriber: vporpo. · View Herald Transcript
ABataev updated this revision to Diff 459096.Sep 9 2022, 9:30 AM
RKSimon added inline comments.Sep 10 2022, 4:19 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
5893–5896

I->getOperand(OpIdx) == Op0;

5900–5907

auto *Op = I->getOperand(OpIdx);

5902

true?

ABataev added inline comments.Sep 12 2022, 7:12 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
5902

Here is my idea. Generally speaking, here we can have only undef/poison or just a pointer (as part of getelementpr node) currently (maybe, need to add an assert). I thought that because of that we can treat its (virtual) operand as power-of-2, since it can be any value. Thoughts?

ABataev updated this revision to Diff 459464.Sep 12 2022, 8:11 AM

Address comments

ABataev updated this revision to Diff 462887.Sep 26 2022, 6:20 AM

Rebase. Ping!

RKSimon added inline comments.Sep 28 2022, 6:13 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6231

Is this purely compile time saving?

6259

Can't we directly initialize Operands from PHI-> incoming_values()? Or even create a ArrayRef<> from it?

6307

We're going to lose the recent scalarization cost improvement here :-(

6545

Would isa<UnaryOperator> ? 0 : 1 be better?

6595

Why do you avoid allowing uniform as well? Can't you just use getOperandInfo(VL, 0)..getNoProps() below ?

ABataev added inline comments.Sep 28 2022, 7:13 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6231

Replaced by 0, since it does not matter.

6259

operand_value returns llvm::Use, Operands list requires Value *. Did not find better way to do it.

6595

Just missed this change, will fix.

ABataev updated this revision to Diff 463564.Sep 28 2022, 7:54 AM

Rebase, address comments

RKSimon added inline comments.Oct 10 2022, 8:53 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
5902

Still not sure about this - this undef case is fine, but the GEP I can imagine might not work in all special cases.

How good is return isa<UndefValue>(V); instead?

5916

return isa<UndefValue>(V)?

RKSimon added inline comments.Oct 10 2022, 8:57 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6504

Why didn't we ever use getGEPCost?

ABataev added inline comments.Oct 10 2022, 9:21 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6504

It originally used add cost for GEPs, most probably there were getGEPCost. Plus, I don't see target-specific getGEPCost implementations, looks like we have only base one.
We could try to switch to getGEPCost but it must be in a separate patch.

ABataev added inline comments.Oct 10 2022, 9:33 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
5902

GetElementPtr may have just a pointer, which is not a GEP instructions.
Say, we have this:

void @foo(ptr %v) {
...
load %v
%n = getelementptr i32, ptr v, 1
load %n
...
}

and we may have a ПУЗ node which includes {%v, %n}. Here %v is not a GEP though still part of the GEP node and we consider as gentlementptr ptr %v, 0.

RKSimon added inline comments.Oct 10 2022, 9:57 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
5902

OK - so for GEPs you're saying that either the operands will be constant or a phi of constants?

6262

I'm sorry but I had to revert the ScalarizationOverheadBuilder code - this needs reverting back to the older version

ABataev added inline comments.Oct 10 2022, 10:28 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
5902

No (or I missed something). I mean, that except for GEPs we may have just a non-ПУЗ pointer value and we just treat it as getelementptr, 0. But we return true if we have just a value (which is GEP with offset 0) and all other GEPs are power-of-2 constant ints.

RKSimon added inline comments.Oct 13 2022, 9:43 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6438

So CommonCost is only applied if (!MinBWs.count(VL0) || VecTy != SrcVecTy) ?

ABataev added inline comments.Oct 13 2022, 9:59 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6438

Yeah, looks like should not ignore it here, since it includes the shuffle cost.

ABataev updated this revision to Diff 467530.Oct 13 2022, 10:40 AM

Address comments

vdmitrie added inline comments.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6221

Do you have a specific reason to keep this as lambda(lambda(...),lambda(...)) design?
I mean this would look much better if you make one more step and outline this into a separate class (for example CostDifferentiator) with dedicated methods instead of stuffing code with tons of lambdas.

ABataev added inline comments.Oct 13 2022, 1:07 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6221

It will still have lambdas for each particular opcode

vdmitrie added inline comments.Oct 13 2022, 1:10 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6221

Why? It is not prohibited to have dedicated method in the class for each particular opcode.

ABataev added inline comments.Oct 13 2022, 2:17 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6221

It still will be a switch with functions calls, which have the pretty similar loops and other processing. This what exactly I want to avoid - duplicate of the code.

vdmitrie added inline comments.Oct 13 2022, 2:41 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6221

I can't agree with statement that it will be a duplication of code. Organized differently - yes.
IMO it's always worth investing time in developing a better interface.

ABataev added inline comments.Oct 13 2022, 2:46 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6221

I don't quite understand what you're proposing. Provide at least a small example.

vdmitrie added inline comments.Oct 13 2022, 5:26 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6221

Just a sketch:

RKSimon added inline comments.Oct 14 2022, 1:01 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6231

I'm not sure if we need to pull them out into separate methods if they're just being called once. But it would help a little for readability if the lambdas weren't embedded in the GetCostDiff calls themselves.

So:

auto ScalarEltCost = [](unsigned Idx)  {...};
auto VectorCost = [](InstructionCost CommonCost)  {...};
return GetCostDiff(ScalarEltCost, VectorCost);
ABataev added inline comments.Oct 14 2022, 4:46 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6231

I prefer this approach. I don't want to introduce virtual member functions. Without virtual functions the only approach - generic lambda, which increases codesize.

ABataev updated this revision to Diff 467763.Oct 14 2022, 6:21 AM

Address comments, formatting

vdmitrie added inline comments.Oct 14 2022, 9:15 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6231

What problem you see with virtual class here?
Using named lambdas instead of unnamed ones is definitely better. But essentially it anyway remains a C-style programming, just using C++ syntax. You are also making it very difficult to customize this code downstream. If that is the goal - okay, got it.

ABataev added inline comments.Oct 14 2022, 9:23 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6231

It usually increases compile time.
Why it is hard to customize it?

vdmitrie added inline comments.Oct 14 2022, 9:51 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6231

It usually increases compile time.

Use of C++ has its costs. I'm pretty sure the increase will be unmeasurable.
I believe that if invest a bit more time into this something better can be found.

Why it is hard to customize it?

because this will require replacing a lambda rather than just make a descendant with custom functionality that might fully or partially reuse its base. I'm not saying it is impossible to do that with lambdas. It will just be significantly more ugly: create another lambda with the original one in capture list...

ABataev added inline comments.Oct 14 2022, 10:02 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6231

I though about templated lambda instead of virtual class, but it will implicitly copied across all cases.

RKSimon accepted this revision.Oct 14 2022, 11:18 AM

LGTM

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6231

I don't want to stop this conversation as I'd dearly like to see the SLP code be easier to understand as its complexity/density puts off a lot of people from contributing - but we need somewhere better to discuss this than on a patch review thread.

6247–6254

It looks like theres a clang-format change across this entire switch statement that ideally needs pre-committing to reduce the patch whitespace/indentation diff?

This revision is now accepted and ready to land.Oct 14 2022, 11:18 AM
This revision was landed with ongoing or failed builds.Oct 18 2022, 8:51 AM
This revision was automatically updated to reflect the committed changes.
fmayer added a subscriber: fmayer.Oct 18 2022, 4:34 PM

This seems to have an MSAN error: https://lab.llvm.org/buildbot/#/builders/74/builds/14338/steps/13/logs/stdio

FAIL: LLVM :: Transforms/SLPVectorizer/X86/crash_7zip.ll (57172 of 68894)
******************** TEST 'LLVM :: Transforms/SLPVectorizer/X86/crash_7zip.ll' FAILED ********************
Script:
--
: 'RUN: at line 2';   /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt < /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll
--
Exit Code: 2
Command Output (stderr):
--
==3579288==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x56270dbbe918 in operator() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6569:19
    #1 0x56270dbbe918 in llvm::InstructionCost llvm::function_ref<llvm::InstructionCost (unsigned int)>::callback_fn<llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>)::$_63>(long, unsigned int) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
    #2 0x56270dafc992 in operator() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
    #3 0x56270dafc992 in llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>)::$_58::operator()(llvm::function_ref<llvm::InstructionCost (unsigned int)>, llvm::function_ref<llvm::InstructionCost (llvm::InstructionCost)>) const /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6336:29
    #4 0x56270daeeb36 in llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    #5 0x56270db033d8 in llvm::slpvectorizer::BoUpSLP::getTreeCost(llvm::ArrayRef<llvm::Value*>) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7273:25
    #6 0x56270db4bb38 in llvm::SLPVectorizerPass::vectorizeStoreChain(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, unsigned int, unsigned int) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10379:28
    #7 0x56270db4eadb in llvm::SLPVectorizerPass::vectorizeStores(llvm::ArrayRef<llvm::StoreInst*>, llvm::slpvectorizer::BoUpSLP&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10521:13
    #8 0x56270db4279c in operator() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12807:18
    #9 0x56270db4279c in callback_fn<(lambda at /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12806:9)> /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
    #10 0x56270db4279c in operator() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
    #11 0x56270db4279c in tryToVectorizeSequence<llvm::StoreInst> /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12192:9
    #12 0x56270db4279c in llvm::SLPVectorizerPass::vectorizeStoreChains(llvm::slpvectorizer::BoUpSLP&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12804:16
    #13 0x56270db3f9f7 in llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10332:18
    #14 0x56270db3e0b0 in llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10267:18
    #15 0x56270ddc2a21 in llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
    #16 0x56270bf43ae0 in llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManager.h:517:40
    #17 0x56270779e201 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>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
    #18 0x56270bf4fc31 in llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/PassManager.cpp:124:38
    #19 0x56270779db71 in llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
    #20 0x56270bf40fb0 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManager.h:517:40
    #21 0x562706b90baf in llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::StringRef>, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/NewPMDriver.cpp:497:7
    #22 0x562706bc0377 in main /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/opt.cpp:784:12
    #23 0x7ff7be184d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
    #24 0x7ff7be184e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
    #25 0x562706af7664 in _start (/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt+0x386a664)
SUMMARY: MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6569:19 in operator()
Exiting
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll

This seems to have an MSAN error: https://lab.llvm.org/buildbot/#/builders/74/builds/14338/steps/13/logs/stdio

FAIL: LLVM :: Transforms/SLPVectorizer/X86/crash_7zip.ll (57172 of 68894)
******************** TEST 'LLVM :: Transforms/SLPVectorizer/X86/crash_7zip.ll' FAILED ********************
Script:
--
: 'RUN: at line 2';   /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt < /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll -slp-vectorizer -dce -S -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7 | /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll
--
Exit Code: 2
Command Output (stderr):
--
==3579288==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x56270dbbe918 in operator() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6569:19
    #1 0x56270dbbe918 in llvm::InstructionCost llvm::function_ref<llvm::InstructionCost (unsigned int)>::callback_fn<llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>)::$_63>(long, unsigned int) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
    #2 0x56270dafc992 in operator() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
    #3 0x56270dafc992 in llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>)::$_58::operator()(llvm::function_ref<llvm::InstructionCost (unsigned int)>, llvm::function_ref<llvm::InstructionCost (llvm::InstructionCost)>) const /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6336:29
    #4 0x56270daeeb36 in llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    #5 0x56270db033d8 in llvm::slpvectorizer::BoUpSLP::getTreeCost(llvm::ArrayRef<llvm::Value*>) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7273:25
    #6 0x56270db4bb38 in llvm::SLPVectorizerPass::vectorizeStoreChain(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, unsigned int, unsigned int) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10379:28
    #7 0x56270db4eadb in llvm::SLPVectorizerPass::vectorizeStores(llvm::ArrayRef<llvm::StoreInst*>, llvm::slpvectorizer::BoUpSLP&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10521:13
    #8 0x56270db4279c in operator() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12807:18
    #9 0x56270db4279c in callback_fn<(lambda at /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12806:9)> /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
    #10 0x56270db4279c in operator() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
    #11 0x56270db4279c in tryToVectorizeSequence<llvm::StoreInst> /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12192:9
    #12 0x56270db4279c in llvm::SLPVectorizerPass::vectorizeStoreChains(llvm::slpvectorizer::BoUpSLP&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12804:16
    #13 0x56270db3f9f7 in llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10332:18
    #14 0x56270db3e0b0 in llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:10267:18
    #15 0x56270ddc2a21 in llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
    #16 0x56270bf43ae0 in llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManager.h:517:40
    #17 0x56270779e201 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>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
    #18 0x56270bf4fc31 in llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/IR/PassManager.cpp:124:38
    #19 0x56270779db71 in llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:88:17
    #20 0x56270bf40fb0 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/include/llvm/IR/PassManager.h:517:40
    #21 0x562706b90baf in llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::StringRef>, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/NewPMDriver.cpp:497:7
    #22 0x562706bc0377 in main /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/tools/opt/opt.cpp:784:12
    #23 0x7ff7be184d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
    #24 0x7ff7be184e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
    #25 0x562706af7664 in _start (/b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/opt+0x386a664)
SUMMARY: MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6569:19 in operator()
Exiting
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/llvm/test/Transforms/SLPVectorizer/X86/crash_7zip.ll

It was already reverted and then committed back with a fix.

It was already reverted and then committed back with a fix.

Sorry about that, I missed the revert line, I only skimmed the comments. Thanks!

LuoYuanke added a subscriber: LuoYuanke.EditedNov 29 2022, 5:24 PM

It seems there is regression for 538 in your data, and we observed the regression for cpu2017/638 too. Could you fix the regression for them?

538.imagick_r -1.42

It seems there is regression for 538 in your data, and we observed the regression for cpu2017/638 too. Could you fix the regression for them?

538.imagick_r -1.42

Not as an immediate fix, hope future changes will fix it.

It seems there is regression for 538 in your data, and we observed the regression for cpu2017/638 too. Could you fix the regression for them?

538.imagick_r -1.42

Not as an immediate fix, hope future changes will fix it.

Do you have any plan to fix it?

It seems there is regression for 538 in your data, and we observed the regression for cpu2017/638 too. Could you fix the regression for them?

538.imagick_r -1.42

Not as an immediate fix, hope future changes will fix it.

Do you have any plan to fix it?

A plan of improving SLP vectorizer, not this particular regression. It will be fixed eventually