-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[LLVMIR] Migrate away from PointerUnion::{is,get} (NFC) #120530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,7 +280,7 @@ getPointerDataLayoutEntry(DataLayoutEntryListRef params, LLVMPointerType type, | |
| for (DataLayoutEntryInterface entry : params) { | ||
| if (!entry.isTypeEntry()) | ||
| continue; | ||
| if (cast<LLVMPointerType>(entry.getKey().get<Type>()).getAddressSpace() == | ||
| if (cast<LLVMPointerType>(cast<Type>(entry.getKey())).getAddressSpace() == | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pre-existing issue, but the mix of llvm::cast and unqualified cast in this file is weird...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. If I drop in Perhaps, we should get rid of
I'm happy to address this in a subsequent patch.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's already marked as deprecated, so maybe it's time to drop it... |
||
| type.getAddressSpace()) { | ||
| currentEntry = entry.getValue(); | ||
| break; | ||
|
|
@@ -356,7 +356,8 @@ bool LLVMPointerType::areCompatible(DataLayoutEntryListRef oldLayout, | |
| continue; | ||
| uint64_t size = kDefaultPointerSizeBits; | ||
| uint64_t abi = kDefaultPointerAlignment; | ||
| auto newType = llvm::cast<LLVMPointerType>(newEntry.getKey().get<Type>()); | ||
| auto newType = | ||
| llvm::cast<LLVMPointerType>(llvm::cast<Type>(newEntry.getKey())); | ||
| const auto *it = | ||
| llvm::find_if(oldLayout, [&](DataLayoutEntryInterface entry) { | ||
| if (auto type = llvm::dyn_cast_if_present<Type>(entry.getKey())) { | ||
|
|
@@ -392,7 +393,7 @@ LogicalResult LLVMPointerType::verifyEntries(DataLayoutEntryListRef entries, | |
| for (DataLayoutEntryInterface entry : entries) { | ||
| if (!entry.isTypeEntry()) | ||
| continue; | ||
| auto key = entry.getKey().get<Type>(); | ||
| auto key = llvm::cast<Type>(entry.getKey()); | ||
| auto values = llvm::dyn_cast<DenseIntElementsAttr>(entry.getValue()); | ||
| if (!values || (values.size() != 3 && values.size() != 4)) { | ||
| return emitError(loc) | ||
|
|
@@ -625,11 +626,12 @@ LogicalResult LLVMStructType::verifyEntries(DataLayoutEntryListRef entries, | |
| if (!entry.isTypeEntry()) | ||
| continue; | ||
|
|
||
| auto key = llvm::cast<LLVMStructType>(entry.getKey().get<Type>()); | ||
| auto key = llvm::cast<LLVMStructType>(llvm::cast<Type>(entry.getKey())); | ||
| auto values = llvm::dyn_cast<DenseIntElementsAttr>(entry.getValue()); | ||
| if (!values || (values.size() != 2 && values.size() != 1)) { | ||
| return emitError(loc) | ||
| << "expected layout attribute for " << entry.getKey().get<Type>() | ||
| << "expected layout attribute for " | ||
| << llvm::cast<Type>(entry.getKey()) | ||
| << " to be a dense integer elements attribute of 1 or 2 elements"; | ||
| } | ||
| if (!values.getElementType().isInteger(64)) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.