[PATCH] D118808: Loop Strength Reduce - Optimize unused IVs to final values in the exit block with SCEV

Zaara Syeda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 08:43:17 PDT 2022


syzaara added a comment.

In D118808#3518558 <https://reviews.llvm.org/D118808#3518558>, @uabelho wrote:

> Hi,
>
> The following starts crashing with this patch:
>
>   llc -O1 -o /dev/null bbi-69670_x86.ll
>
> I get:
>
>   llc: ../lib/Transforms/Utils/LoopUtils.cpp:1385: int llvm::rewriteLoopExitValues(llvm::Loop *, llvm::LoopInfo *, llvm::TargetLibraryInfo *, llvm::ScalarEvolution *, const llvm::TargetTransformInfo *, llvm::SCEVExpander &, llvm::DominatorTree *, llvm::ReplaceExitVal, SmallVector<llvm::WeakTrackingVH, 16> &): Assertion `EVL->contains(L) && "LCSSA breach detected!"' failed.
>   PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
>   Stack dump:
>   0.	Program arguments: ../../main-github/llvm/build-all/bin/llc -O1 -o /dev/null bbi-69670_x86.ll
>   1.	Running pass 'Function Pass Manager' on module 'bbi-69670_x86.ll'.
>   2.	Running pass 'Loop Pass Manager' on function '@func_1'
>   3.	Running pass 'Loop Strength Reduction' on basic block '%for.cond6418'
>    #0 0x0000000002abded3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../main-github/llvm/build-all/bin/llc+0x2abded3)
>    #1 0x0000000002abbb4e llvm::sys::RunSignalHandlers() (../../main-github/llvm/build-all/bin/llc+0x2abbb4e)
>    #2 0x0000000002abe256 SignalHandler(int) Signals.cpp:0:0
>    #3 0x00007fcb1f00e630 __restore_rt sigaction.c:0:0
>    #4 0x00007fcb1c755387 raise (/lib64/libc.so.6+0x36387)
>    #5 0x00007fcb1c756a78 abort (/lib64/libc.so.6+0x37a78)
>    #6 0x00007fcb1c74e1a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
>    #7 0x00007fcb1c74e252 (/lib64/libc.so.6+0x2f252)
>    #8 0x0000000002b80be3 llvm::rewriteLoopExitValues(llvm::Loop*, llvm::LoopInfo*, llvm::TargetLibraryInfo*, llvm::ScalarEvolution*, llvm::TargetTransformInfo const*, llvm::SCEVExpander&, llvm::DominatorTree*, llvm::ReplaceExitVal, llvm::SmallVector<llvm::WeakTrackingVH, 16u>&) (../../main-github/llvm/build-all/bin/llc+0x2b80be3)
>    #9 0x00000000024c0a1e ReduceLoopStrength(llvm::Loop*, llvm::IVUsers&, llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&, llvm::TargetTransformInfo const&, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::MemorySSA*) LoopStrengthReduce.cpp:0:0
>   #10 0x00000000024ec121 (anonymous namespace)::LoopStrengthReduce::runOnLoop(llvm::Loop*, llvm::LPPassManager&) LoopStrengthReduce.cpp:0:0
>   #11 0x0000000001b2d17b llvm::LPPassManager::runOnFunction(llvm::Function&) (../../main-github/llvm/build-all/bin/llc+0x1b2d17b)
>   #12 0x000000000230895f llvm::FPPassManager::runOnFunction(llvm::Function&) (../../main-github/llvm/build-all/bin/llc+0x230895f)
>   #13 0x000000000230f398 llvm::FPPassManager::runOnModule(llvm::Module&) (../../main-github/llvm/build-all/bin/llc+0x230f398)
>   #14 0x0000000002308f2d llvm::legacy::PassManagerImpl::run(llvm::Module&) (../../main-github/llvm/build-all/bin/llc+0x2308f2d)
>   #15 0x000000000074a073 main (../../main-github/llvm/build-all/bin/llc+0x74a073)
>   #16 0x00007fcb1c741555 __libc_start_main (/lib64/libc.so.6+0x22555)
>   #17 0x0000000000747670 _start (../../main-github/llvm/build-all/bin/llc+0x747670)
>   Abort
>
> F23089069: bbi-69670_x86.ll <https://reviews.llvm.org/F23089069>
>
> I wouldn't be surprised if it's the dead bb jumping to non-dead code that trips up something:
>
>   for.cond6403:                                     ; preds = %dead, %cont5825
>     %1 = phi i32 [ %.lcssa221, %dead ], [ 0, %cont5825 ]
>     br label %for.cond6418
>   [...]
>   dead:                                             ; No predecessors!
>     br label %for.cond6403
>
> I wrote
>  https://github.com/llvm/llvm-project/issues/55529
> about the crash.

Hi, thanks for letting me know. I will investigate further.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118808



More information about the llvm-commits mailing list