We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a4e694 commit 2eea502Copy full SHA for 2eea502
Sources/LLVM/IRType.swift
@@ -34,6 +34,15 @@ public extension IRType {
34
var context: Context {
35
return Context(llvm: LLVMGetTypeContext(asLLVM()))
36
}
37
+
38
+ /// If this is a vector type, return the element type, otherwise
39
+ /// return `self`.
40
+ var scalarType: IRType {
41
+ guard let vecTy = self as? VectorType else {
42
+ return self
43
+ }
44
+ return vecTy.elementType
45
46
47
48
internal func convertType(_ type: LLVMTypeRef) -> IRType {
0 commit comments