GlobalISel: allow extractvalue to extract an aggregate.
authorTim Northover <tnorthover@apple.com>
Fri, 19 Aug 2016 18:09:41 +0000 (18:09 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 19 Aug 2016 18:09:41 +0000 (18:09 +0000)
llvm-svn: 279287

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll

index ed0ce8d..8703915 100644 (file)
@@ -197,7 +197,7 @@ bool IRTranslator::translateExtractValue(const User &U) {
   uint64_t Offset = 8 * DL->getIndexedOffsetInType(Src->getType(), Indices);
 
   unsigned Res = getOrCreateVReg(EVI);
-  MIRBuilder.buildExtract(LLT{*EVI.getType()}, Res, getOrCreateVReg(*Src),
+  MIRBuilder.buildExtract(LLT{*EVI.getType(), DL}, Res, getOrCreateVReg(*Src),
                           Offset);
 
   return true;
index ea01782..a336df9 100644 (file)
@@ -693,3 +693,14 @@ define i32 @test_extractvalue(%struct.nested* %addr) {
   %res = extractvalue %struct.nested %struct, 1, 1
   ret i32 %res
 }
+
+; CHECK-LABEL: name: test_extractvalue_agg
+; CHECK: [[STRUCT:%[0-9]+]](128) = G_LOAD { s128, p0 }
+; CHECK: [[RES:%[0-9]+]](64) = G_EXTRACT s64 [[STRUCT]], 32
+; CHECK: G_STORE { s64, p0 } [[RES]]
+define void @test_extractvalue_agg(%struct.nested* %addr, {i8, i32}* %addr2) {
+  %struct = load %struct.nested, %struct.nested* %addr
+  %res = extractvalue %struct.nested %struct, 1
+  store {i8, i32} %res, {i8, i32}* %addr2
+  ret void
+}