<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 - Crash in Global Variable Optimizer: "Invalid GetElementPtrInst indices for type!""
href="https://bugs.llvm.org/show_bug.cgi?id=48055">48055</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Crash in Global Variable Optimizer: "Invalid GetElementPtrInst indices for type!"
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rupprecht@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24122" name="attach_24122" title="Reproducer">attachment 24122</a> <a href="attachment.cgi?id=24122&action=edit" title="Reproducer">[details]</a></span>
Reproducer
$ clang -O1 -c /tmp/repro.ll
clang:
/home/rupprecht/src/llvm-project/llvm/include/llvm/IR/Instructions.h:898:
llvm::Type *llvm::checkGEPType(llvm::Type *): Assertion `Ty && "Invalid
GetElementPtrInst indices for type!"' failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -O1 -c /tmp/repro.ll
1. Per-module optimization passes
2. Running pass 'Global Variable Optimizer' on module '/tmp/repro.ll'.
...
#12 0x0000000005f2dfca llvm::checkGEPType(llvm::Type*)
/home/rupprecht/src/llvm-project/llvm/include/llvm/IR/Instructions.h:899:10
#13 0x0000000005f2de24 llvm::GetElementPtrInst::getGEPReturnType(llvm::Type*,
llvm::Value*, llvm::ArrayRef<llvm::Value*>)
/home/rupprecht/src/llvm-project/llvm/include/llvm/IR/Instructions.h:1076:36
#14 0x00000000083dd47c llvm::ConstantFoldGetElementPtr(llvm::Type*,
llvm::Constant*, bool, llvm::Optional<unsigned int>,
llvm::ArrayRef<llvm::Value*>)
/home/rupprecht/src/llvm-project/llvm/lib/IR/ConstantFold.cpp:2307:9
#15 0x00000000083fa6e4 llvm::ConstantExpr::getGetElementPtr(llvm::Type*,
llvm::Constant*, llvm::ArrayRef<llvm::Value*>, bool, llvm::Optional<unsigned
int>, llvm::Type*)
/home/rupprecht/src/llvm-project/llvm/lib/IR/Constants.cpp:2248:17
#16 0x00000000079c9a14 llvm::ConstantExpr::getGetElementPtr(llvm::Type*,
llvm::Constant*, llvm::ArrayRef<llvm::Constant*>, bool, llvm::Optional<unsigned
int>, llvm::Type*)
/home/rupprecht/src/llvm-project/llvm/include/llvm/IR/Constants.h:1177:5
#17 0x0000000009135793 evaluateBitcastFromPtr(llvm::Constant*, llvm::DataLayout
const&, llvm::TargetLibraryInfo const*, std::function<llvm::Constant*
(llvm::Constant*)>)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:197:9
#18 0x00000000091354a0 llvm::Evaluator::ComputeLoadResult(llvm::Constant*)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:243:11
#19 0x0000000009136bef
llvm::Evaluator::EvaluateBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
false, false, void>, false, false>, llvm::BasicBlock*&)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:457:18
#20 0x0000000009138447 llvm::Evaluator::EvaluateFunction(llvm::Function*,
llvm::Constant*&, llvm::SmallVectorImpl<llvm::Constant*> const&)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:698:9
#21 0x00000000091378ed
llvm::Evaluator::EvaluateBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
false, false, void>, false, false>, llvm::BasicBlock*&)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:589:13
#22 0x0000000009138447 llvm::Evaluator::EvaluateFunction(llvm::Function*,
llvm::Constant*&, llvm::SmallVectorImpl<llvm::Constant*> const&)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:698:9
#23 0x00000000091378ed
llvm::Evaluator::EvaluateBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
false, false, void>, false, false>, llvm::BasicBlock*&)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:589:13
#24 0x0000000009138447 llvm::Evaluator::EvaluateFunction(llvm::Function*,
llvm::Constant*&, llvm::SmallVectorImpl<llvm::Constant*> const&)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:698:9
#25 0x00000000091378ed
llvm::Evaluator::EvaluateBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
false, false, void>, false, false>, llvm::BasicBlock*&)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:589:13
#26 0x0000000009138447 llvm::Evaluator::EvaluateFunction(llvm::Function*,
llvm::Constant*&, llvm::SmallVectorImpl<llvm::Constant*> const&)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:698:9
#27 0x00000000087db316 EvaluateStaticConstructor(llvm::Function*,
llvm::DataLayout const&, llvm::TargetLibraryInfo*)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:2734:22
#28 0x00000000087db296 optimizeGlobalsInModule(llvm::Module&, llvm::DataLayout
const&, llvm::function_ref<llvm::TargetLibraryInfo& (llvm::Function&)>,
llvm::function_ref<llvm::TargetTransformInfo& (llvm::Function&)>,
llvm::function_ref<llvm::BlockFrequencyInfo& (llvm::Function&)>,
llvm::function_ref<llvm::DominatorTree&
(llvm::Function&)>)::$_6::operator()(llvm::Function*) const
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:3102:7
#29 0x00000000087db240 bool llvm::function_ref<bool
(llvm::Function*)>::callback_fn<optimizeGlobalsInModule(llvm::Module&,
llvm::DataLayout const&, llvm::function_ref<llvm::TargetLibraryInfo&
(llvm::Function&)>, llvm::function_ref<llvm::TargetTransformInfo&
(llvm::Function&)>, llvm::function_ref<llvm::BlockFrequencyInfo&
(llvm::Function&)>, llvm::function_ref<llvm::DominatorTree&
(llvm::Function&)>)::$_6>(long, llvm::Function*)
/home/rupprecht/src/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185:5
#30 0x0000000009128b9c llvm::function_ref<bool
(llvm::Function*)>::operator()(llvm::Function*) const
/home/rupprecht/src/llvm-project/llvm/include/llvm/ADT/STLExtras.h:209:5
#31 0x000000000912839c llvm::optimizeGlobalCtorsList(llvm::Module&,
llvm::function_ref<bool (llvm::Function*)>)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/CtorUtils.cpp:145:9
#32 0x00000000087cee5e optimizeGlobalsInModule(llvm::Module&, llvm::DataLayout
const&, llvm::function_ref<llvm::TargetLibraryInfo& (llvm::Function&)>,
llvm::function_ref<llvm::TargetTransformInfo& (llvm::Function&)>,
llvm::function_ref<llvm::BlockFrequencyInfo& (llvm::Function&)>,
llvm::function_ref<llvm::DominatorTree& (llvm::Function&)>)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:3101:20
#33 0x00000000087dd180 (anonymous
namespace)::GlobalOptLegacyPass::runOnModule(llvm::Module&)
/home/rupprecht/src/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:3178:5
#34 0x000000000856fa76 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/rupprecht/src/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1634:23</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>