@@ -132,7 +132,21 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
132132 let create_type = |ctype, rust_type| {
133133 let layout = tcx. layout_of ( ParamEnv :: reveal_all ( ) . and ( rust_type) ) . unwrap ( ) ;
134134 let align = layout. align . abi . bytes ( ) ;
135- context. new_c_type ( ctype) . get_aligned ( align)
135+ #[ cfg( feature="master" ) ]
136+ {
137+ context. new_c_type ( ctype) . get_aligned ( align)
138+ }
139+ #[ cfg( not( feature="master" ) ) ]
140+ {
141+ // Since libgccjit 12 doesn't contain the fix to compare aligned integer types,
142+ // only align u128 and i128.
143+ if layout. ty . int_size_and_signed ( tcx) . 0 . bytes ( ) == 16 {
144+ context. new_c_type ( ctype) . get_aligned ( align)
145+ }
146+ else {
147+ context. new_c_type ( ctype)
148+ }
149+ }
136150 } ;
137151
138152 let i8_type = create_type ( CType :: Int8t , tcx. types . i8 ) ;
@@ -271,16 +285,15 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
271285 }
272286
273287 pub fn is_native_int_type ( & self , typ : Type < ' gcc > ) -> bool {
274- // TODO: cache those types to not query libgccjit everytime this is called.
275288 let types = [
276- self . context . new_c_type ( CType :: UInt8t ) ,
277- self . context . new_c_type ( CType :: UInt16t ) ,
278- self . context . new_c_type ( CType :: UInt32t ) ,
279- self . context . new_c_type ( CType :: UInt64t ) ,
280- self . context . new_c_type ( CType :: Int8t ) ,
281- self . context . new_c_type ( CType :: Int16t ) ,
282- self . context . new_c_type ( CType :: Int32t ) ,
283- self . context . new_c_type ( CType :: Int64t ) ,
289+ self . u8_type ,
290+ self . u16_type ,
291+ self . u32_type ,
292+ self . u64_type ,
293+ self . i8_type ,
294+ self . i16_type ,
295+ self . i32_type ,
296+ self . i64_type ,
284297 ] ;
285298
286299 for native_type in types {
0 commit comments