<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Assertion `this->getType()->isVectorTy() && "Only valid for vectors!"' failed."
   href="https://llvm.org/bugs/show_bug.cgi?id=30366">30366</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `this->getType()->isVectorTy() && "Only valid for vectors!"' 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>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17254" name="attach_17254" title="Reproducer">attachment 17254</a> <a href="attachment.cgi?id=17254&action=edit" title="Reproducer">[details]</a></span>
Reproducer

Instcombine crashes on the attached input if doing
opt -S red.ll -instcombine


#0  0x00007ffff67bfc37 in __GI_raise (sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff67c3028 in __GI_abort () at abort.c:89
#2  0x00007ffff67b8bf6 in __assert_fail_base (fmt=0x7ffff69093b8 "%s%s%s:%u:
%s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x39957c6 "this->getType()->isVectorTy() &&
\"Only valid for vectors!\"", file=file@entry=0x3994909
"../lib/IR/Constants.cpp", line=line@entry=1295, 
    function=function@entry=0x3995801 "llvm::Constant
*llvm::Constant::getSplatValue() const") at assert.c:92
#3  0x00007ffff67b8ca2 in __GI___assert_fail (assertion=0x39957c6
"this->getType()->isVectorTy() && \"Only valid for vectors!\"", file=0x3994909
"../lib/IR/Constants.cpp", 
    line=1295, function=0x3995801 "llvm::Constant
*llvm::Constant::getSplatValue() const") at assert.c:101
#4  0x00000000021ba5c8 in llvm::Constant::getSplatValue (this=0x4bff360) at
../lib/IR/Constants.cpp:1295
#5  0x00000000021ba6c6 in llvm::Constant::getUniqueInteger (this=0x4bff360) at
../lib/IR/Constants.cpp:1318
#6  0x00000000024f0cc6 in foldUDivShl (Op0=0x4c1a3c8, Op1=0x4bff3a8, I=...,
IC=...) at ../lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1007
#7  0x00000000024ed542 in llvm::InstCombiner::visitUDiv (this=0x7fffffffcfc0,
I=...) at ../lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1109
#8  0x0000000002472883 in llvm::InstVisitor<llvm::InstCombiner,
llvm::Instruction*>::visit (this=0x7fffffffcfc0, I=...) at
../include/llvm/IR/Instruction.def:130
#9  0x000000000246dbbc in llvm::InstCombiner::run (this=0x7fffffffcfc0) at
../lib/Transforms/InstCombine/InstructionCombining.cpp:2932
#10 0x000000000246e5f4 in combineInstructionsOverFunction (F=..., Worklist=...,
AA=0x4c1a360, AC=..., TLI=..., DT=..., TTI=..., ExpensiveCombines=true, LI=0x0)
    at ../lib/Transforms/InstCombine/InstructionCombining.cpp:3167
#11 0x000000000246e89f in llvm::InstructionCombiningPass::runOnFunction
(this=0x4c14940, F=...) at
../lib/Transforms/InstCombine/InstructionCombining.cpp:3225
#12 0x00000000022ba68d in llvm::FPPassManager::runOnFunction (this=0x4c15390,
F=...) at ../lib/IR/LegacyPassManager.cpp:1533
#13 0x00000000022ba9c5 in llvm::FPPassManager::runOnModule (this=0x4c15390,
M=...) at ../lib/IR/LegacyPassManager.cpp:1554
#14 0x00000000022bb1ae in (anonymous namespace)::MPPassManager::runOnModule
(this=0x4bffc50, M=...) at ../lib/IR/LegacyPassManager.cpp:1610
#15 0x00000000022bacab in llvm::legacy::PassManagerImpl::run (this=0x4bff6d0,
M=...) at ../lib/IR/LegacyPassManager.cpp:1713
#16 0x00000000022bb6f1 in llvm::legacy::PassManager::run (this=0x7fffffffdc20,
M=...) at ../lib/IR/LegacyPassManager.cpp:1744
#17 0x0000000000a4d689 in main (argc=4, argv=0x7fffffffe108) at
../tools/opt/opt.cpp:705

up a couple of times:

#4  0x00000000021ba5c8 in llvm::Constant::getSplatValue (this=0x4bff360) at
../lib/IR/Constants.cpp:1295
1295      assert(this->getType()->isVectorTy() && "Only valid for vectors!");
(gdb) call dump()
i16 shl (i16 1, i16 ptrtoint ([1 x i16]* @b to i16))
(gdb) up
#5  0x00000000021ba6c6 in llvm::Constant::getUniqueInteger (this=0x4bff360) at
../lib/IR/Constants.cpp:1318
1318      assert(this->getSplatValue() && "Doesn't contain a unique integer!");
(gdb) l
1313    }
1314
1315    const APInt &Constant::getUniqueInteger() const {
1316      if (const ConstantInt *CI = dyn_cast<ConstantInt>(this))
1317        return CI->getValue();
1318      assert(this->getSplatValue() && "Doesn't contain a unique integer!");
1319      const Constant *C = this->getAggregateElement(0U);
1320      assert(C && isa<ConstantInt>(C) && "Not a vector of numbers!");
1321      return cast<ConstantInt>(C)->getValue();
1322    }
(gdb)

so it expects a constant in Constant::getUniqueInteger but it's a constant
expression instead and then it crashes?</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>