[llvm-bugs] [Bug 34838] New: InstCombine - Assertion "Compare known true or false was not folded"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 4 15:06:46 PDT 2017


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

            Bug ID: 34838
           Summary: InstCombine - Assertion "Compare known true or false
                    was not folded"
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: babokin at gmail.com
                CC: llvm-bugs at lists.llvm.org

clang trunk, rev314936, x86_64.

> cat f.cpp
short a, b, g, h;
int c, e;
unsigned d;
long f;
void i() {
  f = unsigned(e) * -1LL + 9223372036854775807L;
  if (g * (b == c) - 5)
    ;
  else {
    0 / 0 ?: ~~a;
    h = (d - f) * 16 != (b == c);
  }
}

> clang++ -w -O2 -c f.cpp
clang-6.0:
/home/dybaboki/llvm/llvm-trunk-20171004/lib/Transforms/InstCombine/InstCombineCompares.cpp:1893:
llvm::Instruction *llvm::InstCombiner::foldICmpShlConstant(llvm::ICmpInst &,
llvm::BinaryOperator *, const llvm::APInt &): Assertion
`C.ashr(*ShiftAmt).shl(*ShiftAmt) == C && "Compare known true or false was not
folded"' failed.
#0 0x000000000135083f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0x135083f)
#1 0x0000000001350b46 SignalHandler(int)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0x1350b46)
#2 0x00007f20eb910370 __restore_rt (/lib64/libpthread.so.0+0xf370)
#3 0x00007f20ea48c1d7 __GI_raise (/lib64/libc.so.6+0x351d7)
#4 0x00007f20ea48d8c8 __GI_abort (/lib64/libc.so.6+0x368c8)
#5 0x00007f20ea485146 __assert_fail_base (/lib64/libc.so.6+0x2e146)
#6 0x00007f20ea4851f2 (/lib64/libc.so.6+0x2e1f2)
#7 0x0000000001039f5f llvm::InstCombiner::foldICmpShlConstant(llvm::ICmpInst&,
llvm::BinaryOperator*, llvm::APInt const&)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0x1039f5f)
#8 0x000000000103dfff
llvm::InstCombiner::foldICmpInstWithConstant(llvm::ICmpInst&)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0x103dfff)
#9 0x00000000010482b4 llvm::InstCombiner::visitICmpInst(llvm::ICmpInst&)
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0x10482b4)
#10 0x0000000000fed2f3 llvm::InstCombiner::run()
(/home/dybaboki/llvm/bin-trunk-20171004/bin/clang-6.0+0xfed2f3)
<...>

-- 
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/20171004/ba2e75e6/attachment.html>


More information about the llvm-bugs mailing list