<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 --- - [Vectorizer] loop vectorizer crash creating mul with bad operands" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23954&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=Cy8oyG6zTQQRpji35sYumAjBKQO0zFuqz1yEU3k7Ex4&s=gF2xgLvFpfB-l2mMQSAnBajohF7sR50XeEHszZac0vM&e=">23954</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Vectorizer] loop vectorizer crash creating mul with bad operands
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dschuff@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The simple test below crashes with the following assertion:

opt: /s/llvm-upstream/llvm/lib/IR/Instructions.cpp:1702: static
llvm::BinaryOperator
*llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value *,
llvm::Value *, const llvm::Twine &, llvm::Instruction *): Assertion
`S1->getType() == S2->getType() && "Cannot create binary operator with two
operands of differing type!"' failed.

This is called from lib/Transforms/Vectorize/LoopVectorizer.cpp:857

I'll investigate but I'm not too familiar with this code so I though I'd get it
up here too. Pasted below are the full stack trace and the reproducer.


#0  0x00007ffff65b7cc9 in __GI_raise (sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff65bb0d8 in __GI_abort () at abort.c:89
#2  0x00007ffff65b0b86 in __assert_fail_base (fmt=0x7ffff6701830 "%s%s%s:%u:
%s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x2252449 "S1->getType() == S2->getType() &&
\"Cannot create binary operator with two operands of differing type!\"",
file=file@entry=0x22505e5 "/s/llvm-upstream/llvm/lib/IR/Instructions.cpp",
line=line@entry=1702, 
    function=function@entry=0x22524b0 "static llvm::BinaryOperator
*llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value *,
llvm::Value *, const llvm::Twine &, llvm::Instruction *)") at assert.c:92
#3  0x00007ffff65b0c32 in __GI___assert_fail (
    assertion=0x2252449 "S1->getType() == S2->getType() && \"Cannot create
binary operator with two operands of differing type!\"", 
    file=0x22505e5 "/s/llvm-upstream/llvm/lib/IR/Instructions.cpp", line=1702, 
    function=0x22524b0 "static llvm::BinaryOperator
*llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value *,
llvm::Value *, const llvm::Twine &, llvm::Instruction *)") at assert.c:101
#4  0x00000000013b1022 in llvm::BinaryOperator::Create
(Op=llvm::Instruction::Mul, S1=0x2da9aa0, S2=0x2d943b0, Name=...,
InsertBefore=0x0)
    at /s/llvm-upstream/llvm/lib/IR/Instructions.cpp:1701
#5  0x0000000000b2c512 in llvm::IRBuilder<true, llvm::ConstantFolder,
llvm::IRBuilderDefaultInserter<true> >::CreateInsertNUWNSWBinOp (
    this=0x7fffffffc188, Opc=llvm::Instruction::Mul, LHS=0x2da9aa0,
RHS=0x2d943b0, Name=..., HasNUW=false, HasNSW=false)
    at /s/llvm-upstream/llvm/include/llvm/IR/IRBuilder.h:705
#6  0x0000000000ef8ccb in llvm::IRBuilder<true, llvm::ConstantFolder,
llvm::IRBuilderDefaultInserter<true> >::CreateMul (
    this=0x7fffffffc188, LHS=0x2da9aa0, RHS=0x2d943b0, Name=..., HasNUW=false,
HasNSW=false)
    at /s/llvm-upstream/llvm/include/llvm/IR/IRBuilder.h:771
#7  0x00000000019de534 in (anonymous
namespace)::LoopVectorizationLegality::InductionInfo::transform
(this=0x7fffffffbf38, B=..., 
    Index=0x2da9aa0) at
/s/llvm-upstream/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:857
#8  0x00000000019dfd10 in (anonymous
namespace)::InnerLoopVectorizer::createEmptyLoop (this=0x7fffffffc760)
    at /s/llvm-upstream/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:2802
#9  0x00000000019d04fb in (anonymous namespace)::InnerLoopVectorizer::vectorize
(this=0x7fffffffc760, L=0x7fffffffccc0)
    at /s/llvm-upstream/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:274
#10 0x00000000019ce1f8 in (anonymous namespace)::LoopVectorize::processLoop
(this=0x2d94180, L=0x2da1750)
    at /s/llvm-upstream/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1667
#11 0x00000000019cd190 in (anonymous namespace)::LoopVectorize::runOnFunction
(this=0x2d94180, F=...)
    at /s/llvm-upstream/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1476
#12 0x00000000013ddacd in llvm::FPPassManager::runOnFunction (this=0x2d95ab0,
F=...)
    at /s/llvm-upstream/llvm/lib/IR/LegacyPassManager.cpp:1520
#13 0x00000000013ddde5 in llvm::FPPassManager::runOnModule (this=0x2d95ab0,
M=...)
    at /s/llvm-upstream/llvm/lib/IR/LegacyPassManager.cpp:1540
#14 0x00000000013de4d0 in (anonymous namespace)::MPPassManager::runOnModule
(this=0x2d91800, M=...)
    at /s/llvm-upstream/llvm/lib/IR/LegacyPassManager.cpp:1596
#15 0x00000000013de0a6 in llvm::legacy::PassManagerImpl::run (this=0x2d91450,
M=...)
    at /s/llvm-upstream/llvm/lib/IR/LegacyPassManager.cpp:1698
#16 0x00000000013de981 in llvm::legacy::PassManager::run (this=0x7fffffffd8f8,
M=...)
    at /s/llvm-upstream/llvm/lib/IR/LegacyPassManager.cpp:1729
#17 0x0000000000798e8c in main (argc=3, argv=0x7fffffffdcd8) at
/s/llvm-upstream/llvm/tools/opt/opt.cpp:599



target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"

; Function Attrs: nounwind uwtable
define i32 @bfd_arch_i386_fill_fill(i64 %p1) #0 {
entry:
  br i1 undef, label %while.end, label %while.body

while.body:                                       ; preds = %while.body, %entry
  %p.05 = phi i8* [ %add.ptr, %while.body ], [ null, %entry ]
  ;%p.05 = i8* 
  %p1.addr.04 = phi i64 [ %sub, %while.body ], [ %p1, %entry ]
  %add.ptr = getelementptr inbounds i8, i8* %p.05, i32 2
  %sub = add nsw i64 %p1.addr.04, -2
  %tobool = icmp eq i64 %sub, 0
  br i1 %tobool, label %while.end, label %while.body

while.end:                                        ; preds = %while.body, %entry
  ret i32 undef
}

attributes #0 = { nounwind uwtable "less-precise-fpmad"="false"
"no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"unsafe-fp-math"="false" "use-soft-float"="false" }</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>