[llvm] 8b48223 - Recommit "[VPlan] Remove uneeded needsVectorIV check."
Alexander Kornienko via llvm-commits
llvm-commits at lists.llvm.org
Mon May 9 09:06:14 PDT 2022
Florian, this commit causes a crash in clang:
$ cat q.cc
int a[2];
int b;
bool c() {
bool d;
for (int e; e; e--) {
d = !d;
b += d ?: a[e];
}
return b;
}
$ ./clang -cc1 -triple x86_64--linux-gnu -emit-obj -O2 -vectorize-loops q.cc
Stack dump:
0. Program arguments: ./clang -cc1 -triple x86_64--linux-gnu
-emit-obj -O2 -vectorize-loops q.cc
1. <eof> parser at end of file
2. Optimizer
#0 0x000055cb5104bfa8 llvm::sys::PrintStackTrace(llvm::raw_ostream&,
int) (./clang+0x6e4bfa8)
#1 0x000055cb5104c3c5 SignalHandler(int) (./clang+0x6e4c3c5)
#2 0x00007f464c15b750 __restore_rt (/usr/grte/v5/lib64/libpthread.so.0+0x15750)
#3 0x000055cb4d2f15fc
llvm::VPlanTransforms::optimizeInductions(llvm::VPlan&,
llvm::ScalarEvolution&) (./clang+0x30f15fc)
#4 0x000055cb4d2eae74
llvm::LoopVectorizationPlanner::buildVPlanWithVPRecipes(llvm::VFRange&,
llvm::SmallPtrSetImpl<llvm::Instruction*>&,
llvm::MapVector<llvm::Instruction*, llvm::Instruction*,
llvm::DenseMap<llvm::Instruction*, unsigned int,
llvm::DenseMapInfo<llvm::Instruction*, void>,
llvm::detail::DenseMapPair<llvm::Instruction*, unsigned int> >,
std::__u::vector<std::__u::pair<llvm::Instruction*,
llvm::Instruction*>,
std::__u::allocator<std::__u::pair<llvm::Instruction*,
llvm::Instruction*> > > > const&) (./clang+0x30eae74)
#5 0x000055cb4d2e903b
llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount,
llvm::ElementCount) (./clang+0x30e903b)
#6 0x000055cb4e865734
llvm::LoopVectorizePass::processLoop(llvm::Loop*) (.cold)
(./clang+0x4665734)
#7 0x000055cb4d143dcf
llvm::LoopVectorizePass::runImpl(llvm::Function&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&,
llvm::DominatorTree&, llvm::BlockFrequencyInfo&,
llvm::TargetLibraryInfo*, llvm::DemandedBits&, llvm::AAResults&,
llvm::AssumptionCache&, std::__u::function<llvm::LoopAccessInfo const&
(llvm::Loop&)>&, llvm::OptimizationRemarkEmitter&,
llvm::ProfileSummaryInfo*) (./clang+0x2f43dcf)
#8 0x000055cb4d143b7d llvm::LoopVectorizePass::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) (./clang+0x2f43b7d)
#9 0x000055cb4d143832 llvm::detail::PassModel<llvm::Function,
llvm::LoopVectorizePass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) (./clang+0x2f43832)
#10 0x000055cb4db331fd llvm::PassManager<llvm::Function,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) (./clang+0x39331fd)
#11 0x000055cb4db32db2 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>&) (./clang+0x3932db2)
#12 0x000055cb4d95fd16
llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) (./clang+0x375fd16)
#13 0x000055cb4d3cca92 llvm::detail::PassModel<llvm::Module,
llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) (./clang+0x31cca92)
#14 0x000055cb4d1fdbe4 llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) (./clang+0x2ffdbe4)
#15 0x000055cb4d233efd (anonymous
namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction,
std::__u::unique_ptr<llvm::raw_pwrite_stream,
std::__u::default_delete<llvm::raw_pwrite_stream> >&,
std::__u::unique_ptr<llvm::ToolOutputFile,
std::__u::default_delete<llvm::ToolOutputFile> >&) (./clang+0x3033efd)
#16 0x000055cb4d22cee5
clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction,
std::__u::unique_ptr<llvm::raw_pwrite_stream,
std::__u::default_delete<llvm::raw_pwrite_stream> >)
(./clang+0x302cee5)
#17 0x000055cb4dd2e253
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(./clang+0x3b2e253)
#18 0x000055cb4d226af4 clang::ParseAST(clang::Sema&, bool, bool)
(./clang+0x3026af4)
#19 0x000055cb4d308654 clang::FrontendAction::Execute() (./clang+0x3108654)
#20 0x000055cb4d308472
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(./clang+0x3108472)
#21 0x000055cb4d3082e5
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(./clang+0x31082e5)
#22 0x000055cb4dcf3fca cc1_main(llvm::ArrayRef<char const*>, char
const*, void*) (./clang+0x3af3fca)
#23 0x000055cb4d3cab81 ExecuteCC1Tool(llvm::SmallVectorImpl<char
const*>&) (./clang+0x31cab81)
#24 0x000055cb4dbdddf2 main (./clang+0x39dddf2)
#25 0x00007f464bfe98d3 __libc_start_main (/usr/grte/v5/lib64/libc.so.6+0x628d3)
#26 0x000055cb4d3ca9fa _start (./clang+0x31ca9fa)
Segmentation fault
I'd appreciate, if you could fix or revert the commit soon. Thanks!
On Wed, May 4, 2022 at 11:54 AM Florian Hahn via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
>
> Author: Florian Hahn
> Date: 2022-05-04T10:53:42+01:00
> New Revision: 8b48223447311af8b3022697dd58858e1ce6975f
>
> URL:
> https://github.com/llvm/llvm-project/commit/8b48223447311af8b3022697dd58858e1ce6975f
> DIFF:
> https://github.com/llvm/llvm-project/commit/8b48223447311af8b3022697dd58858e1ce6975f.diff
>
> LOG: Recommit "[VPlan] Remove uneeded needsVectorIV check."
>
> This reverts commit f4e1eaa3755a13f85696be3b74b387122b74a558.
>
> The patch was originally reverted because it uncovered an issue that has
> now been fixed in 0ef8ca6d88aa7e4abc.
>
> Added:
>
>
> Modified:
> llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
>
> Removed:
>
>
>
>
> ################################################################################
> diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
> b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
> index f4d2af2d9de39..e8f2e2f291aec 100644
> --- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
> +++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
> @@ -429,15 +429,8 @@ void VPlanTransforms::optimizeInductions(VPlan &Plan,
> ScalarEvolution &SE) {
> IV->getStartValue(), Step, TruncI ? TruncI->getType() : nullptr);
> HeaderVPBB->insert(Steps, HeaderVPBB->getFirstNonPhi());
>
> - // If there are no vector users of IV, simply update all users to use
> Step
> - // instead.
> - if (!IV->needsVectorIV()) {
> - IV->replaceAllUsesWith(Steps);
> - continue;
> - }
> -
> - // Otherwise only update scalar users of IV to use Step instead. Use
> - // SetVector to ensure the list of users doesn't contain duplicates.
> + // Update scalar users of IV to use Step instead. Use SetVector to
> ensure
> + // the list of users doesn't contain duplicates.
> SetVector<VPUser *> Users(IV->user_begin(), IV->user_end());
> for (VPUser *U : Users) {
> VPRecipeBase *R = cast<VPRecipeBase>(U);
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220509/feac6812/attachment.html>
More information about the llvm-commits
mailing list