<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [LSR] Assertion `!BaseReg->isZero() && "Zero allocated in a base register!"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=40514">40514</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[LSR]  Assertion `!BaseReg->isZero() && "Zero allocated in a base register!"' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>max.kazantsev@azul.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Run opt -loop-reduce -S on the following IR:

; ModuleID = './simple.ll'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
target triple = "x86_64-unknown-linux-gnu"

define i32 @pluto(i32 %arg) #0 {
bb:
  br label %bb10

bb1:                                              ; preds = %bb10
  %tmp = and i64 %tmp24, 4294967295
  %tmp2 = shl i64 %tmp23, 33
  %tmp3 = ashr exact i64 %tmp2, 32
  %tmp4 = add i64 undef, %tmp
  %tmp5 = add i64 %tmp4, %tmp3
  %tmp6 = add i64 %tmp5, undef
  %tmp7 = add i64 %tmp6, undef
  %tmp8 = add i64 undef, %tmp7
  store i64 %tmp8, i64 addrspace(1)* undef, align 8
  %tmp9 = trunc i64 %tmp7 to i32
  ret i32 %tmp9

bb10:                                             ; preds = %bb10, %bb
  %tmp11 = phi i64 [ 9, %bb ], [ %tmp24, %bb10 ]
  %tmp12 = shl i64 undef, 1
  %tmp13 = mul i64 %tmp12, %tmp12
  %tmp14 = shl i64 %tmp13, 1
  %tmp15 = mul i64 %tmp14, %tmp14
  %tmp16 = shl i64 %tmp15, 1
  %tmp17 = mul i64 %tmp16, %tmp16
  %tmp18 = shl i64 %tmp17, 1
  %tmp19 = mul i64 %tmp18, %tmp18
  %tmp20 = shl i64 %tmp19, 1
  %tmp21 = mul i64 %tmp20, %tmp20
  %tmp22 = shl i64 %tmp21, 1
  %tmp23 = mul i64 %tmp22, %tmp22
  %tmp24 = add nuw nsw i64 %tmp11, 1
  br i1 undef, label %bb1, label %bb10
}


attributes #0 = { "target-cpu"="broadwell"
"target-features"="+sse2,+cx16,+sahf,-tbm,-avx512ifma,-sha,-gfni,-fma4,-vpclmulqdq,+prfchw,+bmi2,-cldemote,+fsgsbase,-ptwrite,-xsavec,+popcnt,+aes,-avx512bitalg,-movdiri,-xsaves,-avx512er,-avx512vnni,-avx512vpopcntdq,-pconfig,-clwb,-avx512f,-clzero,-pku,+mmx,-lwp,-rdpid,-xop,+rdseed,-waitpkg,-movdir64b,-sse4a,-avx512bw,-clflushopt,+xsave,-avx512vbmi2,+64bit,-avx512vl,+invpcid,-avx512cd,+avx,-vaes,+rtm,+fma,+bmi,+rdrnd,-mwaitx,+sse4.1,+sse4.2,+avx2,-wbnoinvd,+sse,+lzcnt,+pclmul,-prefetchwt1,+f16c,+ssse3,-sgx,-shstk,+cmov,-avx512vbmi,+movbe,+xsaveopt,-avx512dq,+adx,-avx512pf,+sse3"
}


The failure I have is the following:

opt:
/home/mkazantsev/work/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1528:
bool {anonymous}::LSRUse::InsertFormula(const {anonymous}::Formula&, const
llvm::Loop&): Assertion `!BaseReg->isZero() && "Zero allocated in a base
register!"' failed.
Stack dump:
0.      Program arguments: /home/mkazantsev/work/llvm/build/buildRA/bin/opt
-loop-reduce -S ./simple.ll
1.      Running pass 'Function Pass Manager' on module './simple.ll'.
2.      Running pass 'Loop Pass Manager' on function '@pluto'
3.      Running pass 'Loop Strength Reduction' on basic block '%bb10'
 #0 0x00007fead161bb2a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/mkazantsev/work/llvm/lib/Support/Unix/Signals.inc:498:0
 #1 0x00007fead1619b0a llvm::sys::RunSignalHandlers()
/home/mkazantsev/work/llvm/lib/Support/Signals.cpp:68:0
 #2 0x00007fead1619c45 SignalHandler(int)
/home/mkazantsev/work/llvm/lib/Support/Unix/Signals.inc:357:0
 #3 0x00007fead0ca4390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x00007fead005d428 gsignal
/build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #5 0x00007fead005f02a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
 #6 0x00007fead0055bd7 __assert_fail_base
/build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0
 #7 0x00007fead0055c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
 #8 0x00007fead219ce54 grow
/home/mkazantsev/work/llvm/include/llvm/ADT/DenseMap.h:533:0
 #9 0x00007fead219ce54 InsertIntoBucketImpl<llvm::SmallVector<const
llvm::SCEV*, 4u> > /home/mkazantsev/work/llvm/include/llvm/ADT/DenseMap.h:582:0
#10 0x00007fead219ce54 InsertIntoBucket<const llvm::SmallVector<const
llvm::SCEV*, 4u>&, llvm::detail::DenseSetEmpty&>
/home/mkazantsev/work/llvm/include/llvm/ADT/DenseMap.h:543:0
#11 0x00007fead219ce54 try_emplace<llvm::detail::DenseSetEmpty&>
/home/mkazantsev/work/llvm/include/llvm/ADT/DenseMap.h:263:0
#12 0x00007fead219ce54 insert
/home/mkazantsev/work/llvm/include/llvm/ADT/DenseSet.h:189:0
#13 0x00007fead219ce54 (anonymous namespace)::LSRUse::InsertFormula((anonymous
namespace)::Formula const&, llvm::Loop const&)
/home/mkazantsev/work/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1520:0
#14 0x00007fead219cf6e (anonymous
namespace)::LSRInstance::InsertFormula((anonymous namespace)::LSRUse&, unsigned
int, (anonymous namespace)::Formula const&)
/home/mkazantsev/work/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:3339:0
#15 0x00007fead21a0001 llvm::SmallVectorTemplateCommon<llvm::SCEV const*,
void>::isSmall() const
/home/mkazantsev/work/llvm/include/llvm/ADT/SmallVector.h:103:0
#16 0x00007fead21a0001 ~SmallVectorImpl
/home/mkazantsev/work/llvm/include/llvm/ADT/SmallVector.h:334:0
#17 0x00007fead21a0001 ~SmallVector
/home/mkazantsev/work/llvm/include/llvm/ADT/SmallVector.h:846:0
#18 0x00007fead21a0001 ~Formula
/home/mkazantsev/work/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:314:0
#19 0x00007fead21a0001 GenerateTruncates
/home/mkazantsev/work/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:3980:0
#20 0x00007fead21a0001 (anonymous
namespace)::LSRInstance::GenerateAllReuseFormulae()
/home/mkazantsev/work/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:4207:0
#21 0x00007fead21a39fc (anonymous
namespace)::LSRInstance::LSRInstance(llvm::Loop*, llvm::IVUsers&,
llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&,
llvm::TargetTransformInfo const&)
/home/mkazantsev/work/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5444:0
#22 0x00007fead21a63c6 ReduceLoopStrength(llvm::Loop*, llvm::IVUsers&,
llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&,
llvm::TargetTransformInfo const&)
/home/mkazantsev/work/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:5572:0
#23 0x00007fead25110c1 llvm::LPPassManager::runOnFunction(llvm::Function&)
/home/mkazantsev/work/llvm/lib/Analysis/LoopPass.cpp:223:0
#24 0x00007fead172d78f llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/mkazantsev/work/llvm/lib/IR/LegacyPassManager.cpp:1644:0
#25 0x00007fead172d99c llvm::FPPassManager::runOnModule(llvm::Module&)
/home/mkazantsev/work/llvm/include/llvm/ADT/ilist_node.h:66:0
#26 0x00007fead172e0bb runOnModule
/home/mkazantsev/work/llvm/lib/IR/LegacyPassManager.cpp:1744:0
#27 0x00007fead172e0bb llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/mkazantsev/work/llvm/lib/IR/LegacyPassManager.cpp:1856:0
#28 0x000000000041d5ed main /home/mkazantsev/work/llvm/tools/opt/opt.cpp:893:0
#29 0x00007fead0048830 __libc_start_main
/build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0
#30 0x000000000041dd3a _start
(/home/mkazantsev/work/llvm/build/buildRA/bin/opt+0x41dd3a)
Aborted (core dumped)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>