[llvm-bugs] [Bug 46750] New: Crash in BitcodeReader.cpp under LTO
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 16 07:52:44 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46750
Bug ID: 46750
Summary: Crash in BitcodeReader.cpp under LTO
Product: tools
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: llc
Assignee: unassignedbugs at nondot.org
Reporter: chenmindong120 at gmail.com
CC: llvm-bugs at lists.llvm.org
Created attachment 23736
--> https://bugs.llvm.org/attachment.cgi?id=23736&action=edit
reduced c code
$ clang -O2 -flto=full test.c -o test.o
Or
$ llvm-dis test.o
llvm/lib/IR/Value.cpp:404: void llvm::Value::doRAUW(llvm::Value*,
llvm::Value::ReplaceMetadataUses): Assertion `New->getType() == getType() &&
"replaceAllUses of value with new value of different type!"' failed.
After some trouble shooting, I think the root is it's when parseConstants() in
BitcodeReader reads in a CST_CODE_CE_SELECT record, e.g.
select <selty><cond>, <ty><val1>, <ty><val2>
If “ty” here is a vector type and “cond” is a forward reference, LLVM uses i1
as the placeholder type of “cond” if it cannot find “cond” in ValueList, as the
code follows:
Type *SelectorTy = Type::getInt1Ty(Context);
// The selector might be an i1 or an <n x i1>
// Get the type from the ValueList before getting a forward ref.
if (VectorType *VTy = dyn_cast<VectorType>(CurTy))
if (Value *V = ValueList[Record[0]])
if (SelectorTy != V->getType())
SelectorTy = VectorType::get(SelectorTy, VTy->getNumElements());
However, the program aborts in RAUW() if we find “selty” is a vector type
later, because LLVM are trying to replace an i1 placeholder with an <n x i1>
value.
--
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/20200716/db3ed7e7/attachment.html>
More information about the llvm-bugs
mailing list