[llvm-bugs] [Bug 39751] New: "opt -globalopt" crashes with Assertion `isa<IntegerType>(Elt->getType()) && "Index must be an integer"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 22 02:41:46 PST 2018


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

            Bug ID: 39751
           Summary: "opt -globalopt" crashes with Assertion
                    `isa<IntegerType>(Elt->getType()) && "Index must be an
                    integer"' failed.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 21144
  --> https://bugs.llvm.org/attachment.cgi?id=21144&action=edit
reproducer

Running
 opt -o - -S bbi-21289.ll -globalopt

gives

opt: ../lib/IR/Constants.cpp:355: llvm::Constant
*llvm::Constant::getAggregateElement(llvm::Constant *) const: Assertion
`isa<IntegerType>(Elt->getType()) && "Index must be an integer"' failed.
Stack dump:
0.      Program arguments: build-all/bin/opt -o - -S bbi-21289.ll -globalopt 
1.      Running pass 'Global Variable Optimizer' on module 'bbi-21289.ll'.
#0 0x00000000023d5534 PrintStackTraceSignalHandler(void*)
(build-all/bin/opt+0x23d5534)
#1 0x00000000023d3660 llvm::sys::RunSignalHandlers()
(build-all/bin/opt+0x23d3660)
#2 0x00000000023d5898 SignalHandler(int) (build-all/bin/opt+0x23d5898)
#3 0x00007fc571e38330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007fc570a27c37 gsignal
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fc570a2b028 abort
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fc570a20bf6 __assert_fail_base
/build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fc570a20ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000001d20ac5 llvm::Constant::getAggregateElement(llvm::Constant*)
const (build-all/bin/opt+0x1d20ac5)
#9 0x000000000178e61a
llvm::ConstantFoldLoadThroughGEPConstantExpr(llvm::Constant*,
llvm::ConstantExpr*) (build-all/bin/opt+0x178e61a)
#10 0x0000000001eb6be6 CleanupConstantGlobalUsers(llvm::Value*,
llvm::Constant*, llvm::DataLayout const&, llvm::TargetLibraryInfo*)
(build-all/bin/opt+0x1eb6be6)
#11 0x0000000001eb2ae8 processInternalGlobal(llvm::GlobalVariable*,
llvm::GlobalStatus const&, llvm::TargetLibraryInfo*,
llvm::function_ref<llvm::DominatorTree& (llvm::Function&)>)
(build-all/bin/opt+0x1eb2ae8)
#12 0x0000000001eb23e3 processGlobal(llvm::GlobalValue&,
llvm::TargetLibraryInfo*, llvm::function_ref<llvm::DominatorTree&
(llvm::Function&)>) (build-all/bin/opt+0x1eb23e3)
#13 0x0000000001eafc75 optimizeGlobalsInModule(llvm::Module&, llvm::DataLayout
const&, llvm::TargetLibraryInfo*, llvm::function_ref<llvm::TargetTransformInfo&
(llvm::Function&)>, llvm::function_ref<llvm::BlockFrequencyInfo&
(llvm::Function&)>, llvm::function_ref<llvm::DominatorTree& (llvm::Function&)>)
(build-all/bin/opt+0x1eafc75)
#14 0x0000000001eb1569 (anonymous
namespace)::GlobalOptLegacyPass::runOnModule(llvm::Module&)
(build-all/bin/opt+0x1eb1569)
#15 0x0000000001de58ba llvm::legacy::PassManagerImpl::run(llvm::Module&)
(build-all/bin/opt+0x1de58ba)
#16 0x00000000007acc8b main (build-all/bin/opt+0x7acc8b)
#17 0x00007fc570a12f45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#18 0x000000000079219d _start (build-all/bin/opt+0x79219d)
Abort

The problem seems to be that

 llvm::ConstantFoldLoadThroughGEPConstantExpr

in ConstantFolding.cpp called from CleanupConstantGlobalUsers in GlobalOpt.cpp
can't handle GEPs with vector indices.

When it crashes GEP is

  %0 = getelementptr inbounds [2 x i16], [2 x i16]* @a, i32 0, <2 x i32> <i32
0, i32 1>

and CE is

  <2 x i16*> getelementptr inbounds ([2 x i16], [2 x i16]* @a, <2 x i64>
zeroinitializer, <2 x i64> <i64 0, i64 1>)

-- 
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/20181122/f0591aaf/attachment-0001.html>


More information about the llvm-bugs mailing list