[llvm-bugs] [Bug 50918] New: [LSR] Assertion `!BaseRegs.empty() && "1*reg => reg, should not be needed."' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 27 21:46:47 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50918

            Bug ID: 50918
           Summary: [LSR] Assertion `!BaseRegs.empty() && "1*reg => reg,
                    should not be needed."' failed.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: max.kazantsev at azul.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Run opt -loop-reduce -S on following test:

target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"

define void @test() {
bb:
  br label %bb1

bb1:                                              ; preds = %bb12, %bb
  %tmp2 = phi i64 [ 94, %bb ], [ %tmp20, %bb12 ]
  %tmp3 = phi i32 [ -28407, %bb ], [ %tmp23, %bb12 ]
  %tmp4 = trunc i64 %tmp2 to i32
  %tmp5 = add i32 %tmp3, %tmp4
  %tmp6 = mul i32 undef, %tmp5
  %tmp7 = sub i32 %tmp6, %tmp5
  %tmp8 = shl i32 %tmp7, 1
  %tmp9 = add i32 %tmp8, %tmp3
  %tmp10 = add i32 %tmp9, %tmp4
  %tmp11 = shl i32 %tmp10, 1
  br label %bb21

bb12:                                             ; preds = %bb21
  %tmp13 = mul i32 %tmp22, -101
  %tmp14 = add i32 %tmp22, 2
  %tmp15 = add i32 %tmp14, %tmp13
  %tmp16 = trunc i32 %tmp15 to i8
  %tmp17 = shl i8 %tmp16, 5
  %tmp18 = add i8 %tmp17, 64
  %tmp19 = sext i8 %tmp18 to i32
  %tmp20 = add nsw i64 %tmp2, -3
  br label %bb1

bb21:                                             ; preds = %bb21, %bb1
  %tmp22 = phi i32 [ %tmp11, %bb1 ], [ %tmp23, %bb21 ]
  %tmp23 = add i32 %tmp22, 1
  br i1 false, label %bb12, label %bb21
}

Output:
opt:
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:516:
void {anonymous}::Formula::canonicalize(const llvm::Loop&): Assertion
`!BaseRegs.empty() && "1*reg => reg, should not be needed."' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments: /localhome/mkazantsev/work/llvm/build/RA/bin/opt
-loop-reduce -S ./simplified.ll
1.      Running pass 'Function Pass Manager' on module './simplified.ll'.
2.      Running pass 'Loop Pass Manager' on function '@test'
3.      Running pass 'Loop Strength Reduction' on basic block '%bb21'
 #0 0x00007f4d2b31909c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Support/Unix/Signals.inc:569:0
 #1 0x00007f4d2b317174 llvm::sys::RunSignalHandlers()
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Support/Signals.cpp:76:0
 #2 0x00007f4d2b3178e3 SignalHandler(int)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Support/Unix/Signals.inc:397:0
 #3 0x00007f4d2a470630 __restore_rt sigaction.c:0:0
 #4 0x00007f4d298183d7 raise (/lib64/libc.so.6+0x363d7)
 #5 0x00007f4d29819ac8 abort (/lib64/libc.so.6+0x37ac8)
 #6 0x00007f4d298111a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
 #7 0x00007f4d29811252 (/lib64/libc.so.6+0x2f252)
 #8 0x00007f4d2c359fb9 llvm::SmallVectorBase<unsigned int>::set_size(unsigned
long)
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/SmallVector.h:84:0
 #9 0x00007f4d2c359fb9 llvm::SmallVectorTemplateBase<llvm::SCEV const*,
true>::pop_back()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/SmallVector.h:551:0
#10 0x00007f4d2c359fb9 llvm::SmallVectorImpl<llvm::SCEV const*>::pop_back_val()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/SmallVector.h:636:0
#11 0x00007f4d2c359fb9 (anonymous namespace)::Formula::canonicalize(llvm::Loop
const&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:520:0
#12 0x00007f4d2c363c03 (anonymous
namespace)::LSRInstance::GenerateReassociationsImpl((anonymous
namespace)::LSRUse&, unsigned int, (anonymous namespace)::Formula const&,
unsigned int, unsigned long, bool)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:3678:0
#13 0x00007f4d2c364021 (anonymous
namespace)::LSRInstance::GenerateReassociations((anonymous namespace)::LSRUse&,
unsigned int, (anonymous namespace)::Formula, unsigned int)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:3698:0
#14 0x00007f4d2c363c95 llvm::SmallVectorTemplateCommon<llvm::SCEV const*,
void>::end()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/SmallVector.h:254:0
#15 0x00007f4d2c363c95 llvm::SmallVector<llvm::SCEV const*, 4u>::~SmallVector()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/SmallVector.h:1174:0
#16 0x00007f4d2c363c95 ~Formula
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:339:0
#17 0x00007f4d2c363c95 (anonymous
namespace)::LSRInstance::GenerateReassociationsImpl((anonymous
namespace)::LSRUse&, unsigned int, (anonymous namespace)::Formula const&,
unsigned int, unsigned long, bool)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:3685:0
#18 0x00007f4d2c364021 (anonymous
namespace)::LSRInstance::GenerateReassociations((anonymous namespace)::LSRUse&,
unsigned int, (anonymous namespace)::Formula, unsigned int)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:3698:0
#19 0x00007f4d2c36f293 llvm::SmallVectorTemplateCommon<llvm::SCEV const*,
void>::end()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/SmallVector.h:254:0
#20 0x00007f4d2c36f293 llvm::SmallVector<llvm::SCEV const*, 4u>::~SmallVector()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/SmallVector.h:1174:0
#21 0x00007f4d2c36f293 ~Formula
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:339:0
#22 0x00007f4d2c36f293 (anonymous
namespace)::LSRInstance::GenerateAllReuseFormulae()
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:4312:0
#23 0x00007f4d2c377d8d (anonymous
namespace)::LSRInstance::LSRInstance(llvm::Loop*, llvm::IVUsers&,
llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&,
llvm::TargetTransformInfo const&, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::MemorySSAUpdater*)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5723:0
#24 0x00007f4d2c37b385 ReduceLoopStrength(llvm::Loop*, llvm::IVUsers&,
llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&,
llvm::TargetTransformInfo const&, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::MemorySSA*)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5944:0
#25 0x00007f4d2c37e60b (anonymous
namespace)::LoopStrengthReduce::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5993:0
#26 0x00007f4d2c9050d3 llvm::LPPassManager::runOnFunction(llvm::Function&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/Analysis/LoopPass.cpp:198:0
#27 0x00007f4d2b4695bd llvm::FPPassManager::runOnFunction(llvm::Function&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/IR/LegacyPassManager.cpp:1449:0
#28 0x00007f4d2b4697e9
llvm::ilist_node_impl<llvm::ilist_detail::node_options<llvm::Function, true,
false, void> >::getNext()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/ilist_node.h:66:0
#29 0x00007f4d2b4697e9
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Function, true,
false, void>, false, false>::operator++()
/localhome/mkazantsev/work/llvm/llvm/llvm/include/llvm/ADT/ilist_iterator.h:157:0
#30 0x00007f4d2b4697e9 llvm::FPPassManager::runOnModule(llvm::Module&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/IR/LegacyPassManager.cpp:1484:0
#31 0x00007f4d2b46a498 runOnModule
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/IR/LegacyPassManager.cpp:1561:0
#32 0x00007f4d2b46a498 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/localhome/mkazantsev/work/llvm/llvm/llvm/lib/IR/LegacyPassManager.cpp:542:0
#33 0x000000000041d3a1 main
/localhome/mkazantsev/work/llvm/llvm/llvm/tools/opt/opt.cpp:1103:0
#34 0x00007f4d29804555 __libc_start_main (/lib64/libc.so.6+0x22555)
#35 0x000000000041e091 _start
(/localhome/mkazantsev/work/llvm/build/RA/bin/opt+0x41e091)
Aborted (core dumped)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210628/05adbed5/attachment-0001.html>


More information about the llvm-bugs mailing list