[PATCH] D110972: [DA] Handle mismatching loop levels by updating the numbering scheme
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 12:32:26 PDT 2022
Meinersbur added a comment.
I was able to reproduce the problem without `D71539`:
$ cat da-lcssa.c
void foobar(long n, double *A) {
long i;
for (i = 0; i*n <= n*n; ++i) {
A[i] = i;
}
A[i] = i;
}
$ cat da-lcssa.ll
; ModuleID = 'da-lcssa.c'
source_filename = "da-lcssa.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: argmemonly nofree norecurse nosync nounwind writeonly uwtable
define dso_local void @foobar(i64 noundef %n, ptr nocapture noundef writeonly %A) local_unnamed_addr #0 {
entry:
%mul1 = mul nsw i64 %n, %n
br label %for.body
for.body: ; preds = %entry, %for.body
%i.012 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%conv = sitofp i64 %i.012 to double
%arrayidx = getelementptr inbounds double, ptr %A, i64 %i.012
store double %conv, ptr %arrayidx, align 8, !tbaa !3
%inc = add nuw nsw i64 %i.012, 1
%mul = mul nsw i64 %inc, %n
%cmp.not = icmp sgt i64 %mul, %mul1
br i1 %cmp.not, label %for.end, label %for.body, !llvm.loop !7
for.end: ; preds = %for.body
%conv2 = sitofp i64 %inc to double
%arrayidx3 = getelementptr inbounds double, ptr %A, i64 %inc
store double %conv2, ptr %arrayidx3, align 8, !tbaa !3
ret void
}
attributes #0 = { argmemonly nofree norecurse nosync nounwind writeonly uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1}
!llvm.ident = !{!2}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"uwtable", i32 2}
!2 = !{!"clang version 15.0.0 (/home/meinersbur/src/llvm-project/clang 2d92ee97f1afb3657579a46a7dd4611b61e9cc16)"}
!3 = !{!4, !4, i64 0}
!4 = !{!"double", !5, i64 0}
!5 = !{!"omnipotent char", !6, i64 0}
!6 = !{!"Simple C/C++ TBAA"}
!7 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.mustprogress"}
!9 = !{!"llvm.loop.unroll.disable"}
$ opt da-lcssa.ll -disable-output "-passes=print<da>" -aa-pipeline=basic-aa
'Dependence Analysis' for function 'foobar':
Src: store double %conv, ptr %arrayidx, align 8, !tbaa !3 --> Dst: store double %conv, ptr %arrayidx, align 8, !tbaa !3
da analyze - none!
Src: store double %conv, ptr %arrayidx, align 8, !tbaa !3 --> Dst: store double %conv2, ptr %arrayidx3, align 8, !tbaa !3
da analyze - opt: /home/meinersbur/src/llvm-project/llvm/lib/Analysis/DependenceAnalysis.cpp:1160: bool llvm::DependenceInfo::strongSIVtest(const llvm::SCEV*, const llvm::SCEV*, const llvm::SCEV*, const llvm::Loop*, unsigned int, llvm::FullDependence&, llvm::DependenceInfo::Constraint&) const: Assertion `0 < Level && Level <= CommonLevels && "level out of range"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/meinersbur/build/llvm-project/release/bin/opt da-lcssa.ll -disable-output -passes=print<da> -aa-pipeline=basic-aa
#0 0x00007fa14c381f14 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x00007fa14c37f6b4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007fa1492303c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x143c0)
#3 0x00007fa148c9303b raise /build/glibc-sMfBJT/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#4 0x00007fa148c72859 abort /build/glibc-sMfBJT/glibc-2.31/stdlib/abort.c:81:7
#5 0x00007fa148c72729 get_sysdep_segment_value /build/glibc-sMfBJT/glibc-2.31/intl/loadmsgcat.c:509:8
#6 0x00007fa148c72729 _nl_load_domain /build/glibc-sMfBJT/glibc-2.31/intl/loadmsgcat.c:970:34
#7 0x00007fa148c84006 (/lib/x86_64-linux-gnu/libc.so.6+0x34006)
#8 0x00007fa14af1201c llvm::DependenceInfo::strongSIVtest(llvm::SCEV const*, llvm::SCEV const*, llvm::SCEV const*, llvm::Loop const*, unsigned int, llvm::FullDependence&, llvm::DependenceInfo::Constraint&) const (/home/meinersbur/build/llvm-project/release/bin/opt+0x1c8201c)
#9 0x00007fa14af1eb6a llvm::DependenceInfo::testSIV(llvm::SCEV const*, llvm::SCEV const*, unsigned int&, llvm::FullDependence&, llvm::DependenceInfo::Constraint&, llvm::SCEV const*&) const (.constprop.0) DependenceAnalysis.cpp:0:0
#10 0x00007fa14af23eb8 llvm::DependenceInfo::depends(llvm::Instruction*, llvm::Instruction*, bool) (/home/meinersbur/build/llvm-project/release/bin/opt+0x1c93eb8)
#11 0x00007fa14af255bd dumpExampleDependence(llvm::raw_ostream&, llvm::DependenceInfo*) DependenceAnalysis.cpp:0:0
#12 0x00007fa14af25a76 llvm::DependenceAnalysisPrinterPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/meinersbur/build/llvm-project/release/bin/opt+0x1c95a76)
#13 0x00007fa14c6adad6 llvm::detail::PassModel<llvm::Function, llvm::DependenceAnalysisPrinterPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) PassBuilder.cpp:0:0
#14 0x00007fa14b99f766 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/meinersbur/build/llvm-project/release/bin/opt+0x270f766)
#15 0x00007fa14ad5f936 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>&) NVPTXTargetMachine.cpp:0:0
#16 0x00007fa14b99e179 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/meinersbur/build/llvm-project/release/bin/opt+0x270e179)
#17 0x00007fa14ad5fdc6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) NVPTXTargetMachine.cpp:0:0
#18 0x00007fa14b99bc6f llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/meinersbur/build/llvm-project/release/bin/opt+0x270bc6f)
#19 0x00007fa14a9a7787 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) (/home/meinersbur/build/llvm-project/release/bin/opt+0x1717787)
#20 0x00007fa14a9baa2c main (/home/meinersbur/build/llvm-project/release/bin/opt+0x172aa2c)
#21 0x00007fa148c740b3 __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:342:3
#22 0x00007fa14a99948e _start (/home/meinersbur/build/llvm-project/release/bin/opt+0x170948e)
Aborted (core dumped)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110972/new/
https://reviews.llvm.org/D110972
More information about the llvm-commits
mailing list