[llvm-bugs] [Bug 27557] New: SROA assertion: creating bitcast between ptr types with different addr spaces
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Apr 28 10:03:28 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27557
Bug ID: 27557
Summary: SROA assertion: creating bitcast between ptr types
with different addr spaces
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: jack.liu at intel.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
In SROA.cpp's canConvertValue() function, it will return "true" if both NewTy
and OldTy are ptr type. Probably we need to check whether those two pointers
are pointing to the same addr space; otherwise this will trigger an assertion
later when SROA tries to create a bitcast between pointers with different addr
spaces.
A proposed fix:
--- a/lib/Transforms/Scalar/SROA.cpp
+++ b/lib/Transforms/Scalar/SROA.cpp
@@ -1636,7 +1636,7 @@ static bool canConvertValue(const DataLayout &DL, Type
*OldTy, Type *NewTy) {
NewTy = NewTy->getScalarType();
if (NewTy->isPointerTy() || OldTy->isPointerTy()) {
if (NewTy->isPointerTy() && OldTy->isPointerTy())
- return true;
+ return cast<PointerType>(NewTy)->getPointerAddressSpace() ==
cast<PointerType>(OldTy)->getPointerAddressSpace();
if (NewTy->isIntegerTy() || OldTy->isIntegerTy())
return true;
--
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/20160428/c89f71de/attachment.html>
More information about the llvm-bugs
mailing list