<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 - LoopVectorizer crashing with 'Assertion `Val && "isa<> used on a null pointer"' failed.'"
   href="https://bugs.llvm.org/show_bug.cgi?id=34523">34523</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LoopVectorizer crashing with 'Assertion `Val && "isa<> used on a null pointer"' failed.'
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>mikael.holmen@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19119" name="attach_19119" title="reproducer">attachment 19119</a> <a href="attachment.cgi?id=19119&action=edit" title="reproducer">[details]</a></span>
reproducer

opt -loop-vectorize -S -o /dev/null tr14424.ll

hits an assert

Assertion `Val && "isa<> used on a null pointer"' failed.

(gdb) where
#0  0x00007ffff67bbc37 in __GI_raise (sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff67bf028 in __GI_abort () at abort.c:89
#2  0x00007ffff67b4bf6 in __assert_fail_base (fmt=0x7ffff6909018 "%s%s%s:%u:
%s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x3afa184 "Val &&
\"isa<> used on a null pointer\"", file=file@entry=0x3afa1aa
"../include/llvm/Support/Casting.h", line=line@entry=106,
function=function@entry=0x3b10ba4 "static bool
llvm::isa_impl_cl<llvm::Constant, const llvm::Value *>::doit(const From *) [To
= llvm::Constant, From = const llvm::Value *]") at assert.c:92
#3  0x00007ffff67b4ca2 in __GI___assert_fail (assertion=0x3afa184 "Val &&
\"isa<> used on a null pointer\"", file=0x3afa1aa
"../include/llvm/Support/Casting.h", line=106, function=0x3b10ba4 "static bool
llvm::isa_impl_cl<llvm::Constant, const llvm::Value *>::doit(const From *) [To
= llvm::Constant, From = const llvm::Value *]") at assert.c:101
#4  0x0000000000b96f2e in llvm::isa_impl_cl<llvm::Constant, llvm::Value
const*>::doit (Val=0x0) at ../include/llvm/Support/Casting.h:106
#5  0x0000000000b96ed8 in llvm::isa_impl_wrap<llvm::Constant, llvm::Value
const*, llvm::Value const*>::doit (Val=@0x7fffffffa030: 0x0) at
../include/llvm/Support/Casting.h:133
#6  0x0000000000b96eb2 in llvm::isa_impl_wrap<llvm::Constant, llvm::Value*
const, llvm::Value const*>::doit (Val=@0x7fffffffa078: 0x0) at
../include/llvm/Support/Casting.h:123
#7  0x0000000000b96aa5 in llvm::isa<llvm::Constant, llvm::Value*>
(Val=@0x7fffffffa078: 0x0) at ../include/llvm/Support/Casting.h:143
#8  0x0000000000bb3c58 in llvm::dyn_cast<llvm::Constant, llvm::Value> (Val=0x0)
at ../include/llvm/Support/Casting.h:334
#9  0x0000000000fcaaa7 in llvm::IRBuilder<llvm::ConstantFolder,
llvm::IRBuilderDefaultInserter>::CreateSelect (this=0x7fffffffafd8, C=0x0,
True=0x5d96a40, False=0x5d96a40, Name="", MDFrom=0x0) at
../include/llvm/IR/IRBuilder.h:1691
#10 0x000000000326b980 in llvm::InnerLoopVectorizer::widenPHIInstruction
(this=0x7fffffffaf78, PN=0x5d97978, UF=1, VF=4) at
../lib/Transforms/Vectorize/LoopVectorize.cpp:4532
#11 0x0000000003292235 in (anonymous namespace)::VPWidenPHIRecipe::execute
(this=0x5dcfd80, State=...) at
../lib/Transforms/Vectorize/LoopVectorize.cpp:7744
#12 0x00000000032f8256 in llvm::VPBasicBlock::execute (this=0x5dcfcf0,
State=0x7fffffffa960) at ../lib/Transforms/Vectorize/VPlan.cpp:161
#13 0x00000000032f888f in llvm::VPlan::execute (this=0x5dcaca0,
State=0x7fffffffa960) at ../lib/Transforms/Vectorize/VPlan.cpp:228
#14 0x000000000326e70b in llvm::LoopVectorizationPlanner::executePlan
(this=0x7fffffffbbc8, ILV=..., DT=0x5d947a0) at
../lib/Transforms/Vectorize/LoopVectorize.cpp:7559
#15 0x000000000327250c in llvm::LoopVectorizePass::processLoop (this=0x5d94710,
L=0x5db6620) at ../lib/Transforms/Vectorize/LoopVectorize.cpp:8614
#16 0x0000000003276a8f in llvm::LoopVectorizePass::runImpl(llvm::Function&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&,
llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*,
llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&,
std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&,
llvm::OptimizationRemarkEmitter&) (this=0x5d94710, F=..., SE_=..., LI_=...,
TTI_=..., DT_=..., BFI_=..., TLI_=0x5d98cb0, DB_=..., AA_=..., AC_=...,
GetLAA_=..., ORE_=...) at ../lib/Transforms/Vectorize/LoopVectorize.cpp:8695
#17 0x0000000003293c02 in (anonymous namespace)::LoopVectorize::runOnFunction
(this=0x5d946f0, F=...) at ../lib/Transforms/Vectorize/LoopVectorize.cpp:2368
#18 0x00000000028f583d in llvm::FPPassManager::runOnFunction (this=0x5d9ad00,
F=...) at ../lib/IR/LegacyPassManager.cpp:1514
#19 0x00000000028f5b75 in llvm::FPPassManager::runOnModule (this=0x5d9ad00,
M=...) at ../lib/IR/LegacyPassManager.cpp:1535
#20 0x00000000028f635e in (anonymous namespace)::MPPassManager::runOnModule
(this=0x5d987a0, M=...) at ../lib/IR/LegacyPassManager.cpp:1591
#21 0x00000000028f5e5b in llvm::legacy::PassManagerImpl::run (this=0x5d982b0,
M=...) at ../lib/IR/LegacyPassManager.cpp:1694
#22 0x00000000028f68a1 in llvm::legacy::PassManager::run (this=0x7fffffffd4f8,
M=...) at ../lib/IR/LegacyPassManager.cpp:1725
#23 0x0000000000b54c45 in main (argc=7, argv=0x7fffffffda98) at
../tools/opt/opt.cpp:757

So we pass nullptr to CreateSelect at

          Entry[Part] = Builder.CreateSelect(Cond[Part], In0, In0);

in InnerLoopVectorizer::widenPHIInstruction, which it isn't very happy about.

It seems to start happening with commit

 [LV] Avoid redundant operations manipulating masks

but the funny thing is that I can't seem to make the crash go away on trunk now
even if I revert that commit.</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>