[llvm-bugs] [Bug 36583] New: [InstCombine] Blows up when attempting to foldICmpWithCastAndCast of a vector icmp

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 2 13:53:15 PST 2018


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

            Bug ID: 36583
           Summary: [InstCombine] Blows up when attempting to
                    foldICmpWithCastAndCast of a vector icmp
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dneilson at azul.com
                CC: llvm-bugs at lists.llvm.org

Source IR:
target datalayout = "e"
target triple = "x86_64-unknown-linux-gnu"

define <2 x i1> @foo(<2 x i8*>)  {
entry:
  %as.int = ptrtoint <2 x i8*> %0 to <2 x i64>
  %shift = lshr <2 x i64> %as.int, zeroinitializer
  %res = icmp eq <2 x i64> %shift, zeroinitializer
  ret <2 x i1> %res
}

---

Run with: opt -instcombine -S test.ll

Result:
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"),
function cast, file
/Users/dneilson/Development/LLVM-dev/llvm/include/llvm/Support/Casting.h, line
255.
0  opt                      0x0000000103c1efec
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1  opt                      0x0000000103c1f5e9
PrintStackTraceSignalHandler(void*) + 25
2  opt                      0x0000000103c1b0e9 llvm::sys::RunSignalHandlers() +
425
3  opt                      0x0000000103c1fa02 SignalHandler(int) + 354
4  libsystem_platform.dylib 0x00007fff64326f5a _sigtramp + 26
5  libsystem_platform.dylib 0x0000000000019858 _sigtramp + 2614044952
6  libsystem_c.dylib        0x00007fff64151312 abort + 127
7  libsystem_c.dylib        0x00007fff64119368 basename_r + 0
8  opt                      0x0000000100934057
llvm::cast_retty<llvm::IntegerType, llvm::Type const*>::ret_type
llvm::cast<llvm::IntegerType, llvm::Type const>(llvm::Type const*) + 103
9  opt                      0x0000000100933945 llvm::Type::getIntegerBitWidth()
const + 21
10 opt                      0x00000001033fd41b
llvm::InstCombiner::foldICmpWithCastAndCast(llvm::ICmpInst&) + 155
11 opt                      0x00000001034020a3
llvm::InstCombiner::visitICmpInst(llvm::ICmpInst&) + 3363
12 opt                      0x000000010338d138
llvm::InstVisitor<llvm::InstCombiner,
llvm::Instruction*>::visitICmp(llvm::ICmpInst&) + 40
13 opt                      0x000000010337eb2c
llvm::InstVisitor<llvm::InstCombiner,
llvm::Instruction*>::visit(llvm::Instruction&) + 1516
14 opt                      0x000000010337deb9 llvm::InstCombiner::run() + 2569
15 opt                      0x000000010337f44f
combineInstructionsOverFunction(llvm::Function&, llvm::InstCombineWorklist&,
llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&,
llvm::DominatorTree&, llvm::OptimizationRemarkEmitter&, bool, llvm::LoopInfo*)
+ 1007
16 opt                      0x000000010337f6d6
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&) + 342
17 opt                      0x000000010303bddf
llvm::FPPassManager::runOnFunction(llvm::Function&) + 399
18 opt                      0x000000010303c2e5
llvm::FPPassManager::runOnModule(llvm::Module&) + 117
19 opt                      0x000000010303d0b4 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 2196
20 opt                      0x000000010303c5a6
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 342
21 opt                      0x000000010303dde1
llvm::legacy::PassManager::run(llvm::Module&) + 33
22 opt                      0x000000010097dde4 main + 27636
23 libdyld.dylib            0x00007fff640a5115 start + 1

---

Expected:
define <2 x i1> @foo(<2 x i8*>)  {
entry:
  %res = icmp eq <2 x i8*> %0, zeroinitializer
  ret <2 x i1> %res
}

-- 
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/20180302/cad36b49/attachment-0001.html>


More information about the llvm-bugs mailing list