Bug 2025710
| Summary: | Test fails on s390x: test/Transforms/SLPVectorizer/slp-max-phi-size.ll | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Tom Stellard <tstellar> | ||||
| Component: | llvm | Assignee: | serge_sans_paille <sguelton> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Miloš Prchlík <mprchlik> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 8.6 | CC: | jakub, mprchlik, sguelton | ||||
| Target Milestone: | rc | Keywords: | Bugfix, Triaged | ||||
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | llvm-13.0.1-1.module+el8.6.0+14118+d530a951 | Doc Type: | No Doc Update | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2022-05-10 13:52:26 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | 2028609 | ||||||
| Bug Blocks: | |||||||
| Attachments: |
|
||||||
As a short term workaround: changing the type of `Incoming` to `std::vector` instead of `SmallVector` fixes the issue, which seems to be a gcc miscompilation (or a bug in LLVM Codebase). Switching for -O2 to -O1 for SLPVectorizerPass::vectorizeChainsInBlock also fixes the issue. I'll try to compile with a later GCC version to check if it changes something. Some more inputs.
I've been recompiling SLPVectorizer.cpp with different version of GCC trying to understand which version generates segfaulting code and which version doesn't. I've also tried to use `#pragma GCC optimize("O2")` on a smaller block and compile the remaining part in `-O1` in order to reduce the scope.
failing gcc version: 635aeaa20ffdf6e794f180cc8e053e8dc46db760
next version (working): ef976be1a23a5171082cf1a569d00573013a175c
When recompiling gcc I used:
../configure --enable-languages=c,c++ --prefix=$PWD/../install --disable-bootstrap --disable-sjlj-exceptions --disable-multilib --disable-libsanitizer --with-long-double-128 --with-arch=z13 --with-tune=z14 && make -j3 && make install
Then the SLPVectorizer.cpp got compiled with:
/root/gcc/install/bin/g++ -save-temps -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Transforms/Vectorize -I/root/llvm-project/llvm/lib/Transforms/Vectorize -Iinclude -I/root/llvm-project/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O1 -g -DNDEBUG -fPIC -fno-exceptions -fno-rtti -std=c++14 -MD -MT lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/SLPVectorizer.cpp.o -MF lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/SLPVectorizer.cpp.o.d -o lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/SLPVectorizer.cpp.o -c /root/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
I saved the temporaries as SLPVectorizer.works.ii, SLPVectorizer.works.s, SLPVectorizer.fails.ii and SLPVectorizer.fails.s, attached to this bug.
Extra information: the error is spotted by valgrind as an uninitialized value: =1584621== Conditional jump or move depends on uninitialised value(s) ==1584621== at 0x5CD5574: isEqual (DenseMapInfo.h:235) ==1584621== by 0x5CD5574: LookupBucketFor<std::pair<llvm::AnalysisKey*, llvm::Function*> > (DenseMap.h:631) ==1584621== by 0x5CD5574: find (DenseMap.h:161) ==1584621== by 0x5CD5574: getCachedResultImpl (PassManager.h:890) ==1584621== by 0x5CD5574: getCachedResult<llvm::TargetLibraryAnalysis> (PassManager.h:806) ==1584621== by 0x5CD5574: llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (SLPVectorizer.cpp:7606) ==1584621== by 0x4A5F801: llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Fun ction>&) (PassManagerInternal.h:88) ==1584621== by 0x67CD547: llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (PassManager.h:525) ==1584621== by 0x4A5B5E1: 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>&) (PassManagerInternal.h:88) ==1584621== by 0x67CBDC9: llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (PassManager.cpp:128) ==1584621== by 0x1023279: llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm: :Module>&) (PassManagerInternal.h:88) ==1584621== by 0x67C8BB1: llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (PassManager.h:525) ==1584621== by 0x102D949: llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::S tringRef, llvm::ArrayRef<llvm::StringRef>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool) (NewPMDriver.cpp:487) ==1584621== by 0x101E7E3: main (opt.cpp:818) Semantically, I checked that the bucket lookup is in bound. Verified with llvm-toolset:rhel8:8060020220204053142:d63f516d. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (llvm-toolset:rhel8 bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:1856 |
Created attachment 1843059 [details] Reduced test case The test test/Transforms/SLPVectorizer/slp-max-phi-size.ll fails on s390x. slp-max-phi-size.ll doesn't crash, it just produces the wrong output, but I've attached a reduced test case that does crash. My guess it is the same problem causing both failures .ll files. My best guess is that the storage member of the SmallDenseMap class is being used uninitialized, I've seen different versions of gcc warn about uninitialized usage of this variable.