<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 - Assertion in Sparse conditional constant propagation"
   href="https://bugs.llvm.org/show_bug.cgi?id=47991">47991</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion in Sparse conditional constant propagation
          </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>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>axel.y.rivera@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24107" name="attach_24107" title="Simplified test case">attachment 24107</a> <a href="attachment.cgi?id=24107&action=edit" title="Simplified test case">[details]</a></span>
Simplified test case

Hi,

I'm getting an assertion with the simple test case that was attached. It can be
replicated with the following command:

opt -ipsccp -S simple.ll

The issue is dying in the following line:

%tmp4 = trunc i512 %tmp3 to i32

The truncate function in ConstantRange identifies that it is trying to convert
from 8-bits to 32-bits, which triggers the assertion.

This is the callback trace:

opt: /llvm/llvm/lib/IR/ConstantRange.cpp:721: llvm::ConstantRange
llvm::ConstantRange::truncate(uint32_t) const: Assertion `getBitWidth() >
DstTySize && "Not a value truncation"' failed.                                  
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.      
Stack dump:                                                                     
0.      Program arguments: opt -ipsccp -S simple.ll                             
1.      Running pass 'Interprocedural Sparse Conditional Constant Propagation'
on module 'simple.ll'.                                                          
 #0 0x00000000036eafe1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/llvm/llvm/lib/Support/Unix/Signals.inc:563:0                             
 #1 0x00000000036eb098 PrintStackTraceSignalHandler(void*)
/llvm/llvm/lib/Support/Unix/Signals.inc:630:0                                   
 #2 0x00000000036e90a1 llvm::sys::RunSignalHandlers()
/llvm/llvm/lib/Support/Signals.cpp:71:0                                         
 #3 0x00000000036eaa24 SignalHandler(int)
/llvm/llvm/lib/Support/Unix/Signals.inc:405:0                                   
 #4 0x00007fe76acd15e0 __restore_rt (/lib64/libpthread.so.0+0xf5e0)             
 #5 0x00007fe7698531f7 raise (/lib64/libc.so.6+0x351f7)                         
 #6 0x00007fe7698548e8 abort (/lib64/libc.so.6+0x368e8)                         
 #7 0x00007fe76984c266 __assert_fail_base (/lib64/libc.so.6+0x2e266)            
 #8 0x00007fe76984c312 (/lib64/libc.so.6+0x2e312)                               
 #9 0x0000000002b37e2b llvm::ConstantRange::truncate(unsigned int) const
/llvm/llvm/lib/IR/ConstantRange.cpp:722:0                                   
#10 0x0000000002b3766d llvm::ConstantRange::castOp(llvm::Instruction::CastOps,
unsigned int) const /llvm/llvm/lib/IR/ConstantRange.cpp:648:0         
#11 0x00000000035147ff (anonymous
namespace)::SCCPSolver::visitCastInst(llvm::CastInst&)
/llvm/llvm/lib/Transforms/Scalar/SCCP.cpp:848:0             
#12 0x000000000351c99d llvm::InstVisitor<(anonymous namespace)::SCCPSolver,
void>::visitTruncInst(llvm::TruncInst&)
/llvm/llvm/include/llvm/IR/InstVisitor.h:177:0                                  
#13 0x000000000351c1d1 llvm::InstVisitor<(anonymous namespace)::SCCPSolver,
void>::visitTrunc(llvm::TruncInst&)
/llvm/llvm/include/llvm/IR/Instruction.def:184:0
#14 0x000000000351b7db llvm::InstVisitor<(anonymous namespace)::SCCPSolver,
void>::visit(llvm::Instruction&)
/llvm/llvm/include/llvm/IR/Instruction.def:184:0
#15 0x000000000351cef4 void llvm::InstVisitor<(anonymous
namespace)::SCCPSolver,
void>::visit<llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
true, false, void>, false, false>
<span class="quote">>(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,</span >
true, false, void>, false, false>,
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true,
false, void>, false, false>) /llvm/llvm/include/llvm/IR/InstVisitor.h:89:0
#16 0x000000000351c676 llvm::InstVisitor<(anonymous namespace)::SCCPSolver,
void>::visit(llvm::BasicBlock&) /llvm/llvm/include/llvm/IR/InstVisitor.h:106:0
#17 0x000000000351baa7 llvm::InstVisitor<(anonymous namespace)::SCCPSolver,
void>::visit(llvm::BasicBlock*) /llvm/llvm/include/llvm/IR/InstVisitor.h:111:0
#18 0x0000000003517c5f (anonymous namespace)::SCCPSolver::Solve()
/llvm/llvm/lib/Transforms/Scalar/SCCP.cpp:1440:0
#19 0x0000000003519f66 llvm::runIPSCCP(llvm::Module&, llvm::DataLayout const&,
std::function<llvm::TargetLibraryInfo const& (llvm::Function&)>,
llvm::function_ref<llvm::AnalysisResultsForFn (llvm::Function&)>)
/llvm/llvm/lib/Transforms/Scalar/SCCP.cpp:1969:0
#20 0x0000000002f78133 (anonymous
namespace)::IPSCCPLegacyPass::runOnModule(llvm::Module&)
/llvm/llvm/lib/Transforms/IPO/SCCP.cpp:68:0
#21 0x0000000002c9456b (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/llvm/llvm/lib/IR/LegacyPassManager.cpp:1634:0
#22 0x0000000002c8fa7d llvm::legacy::PassManagerImpl::run(llvm::Module&)
/llvm/llvm/lib/IR/LegacyPassManager.cpp:615:0
#23 0x0000000002c94d57 llvm::legacy::PassManager::run(llvm::Module&)
/llvm/llvm/lib/IR/LegacyPassManager.cpp:1762:0
#24 0x0000000001b4c943 main /llvm/llvm/tools/opt/opt.cpp:1001:0
#25 0x00007fe76983fc05 __libc_start_main (/lib64/libc.so.6+0x21c05)
#26 0x0000000001b16db9 _start (/bin/opt+0x1b16db9)
Aborted</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>