[llvm] r279287 - GlobalISel: allow extractvalue to extract an aggregate.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 11:09:41 PDT 2016


Author: tnorthover
Date: Fri Aug 19 13:09:41 2016
New Revision: 279287

URL: http://llvm.org/viewvc/llvm-project?rev=279287&view=rev
Log:
GlobalISel: allow extractvalue to extract an aggregate.

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

Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=279287&r1=279286&r2=279287&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Fri Aug 19 13:09:41 2016
@@ -197,7 +197,7 @@ bool IRTranslator::translateExtractValue
   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;

Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll?rev=279287&r1=279286&r2=279287&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll Fri Aug 19 13:09:41 2016
@@ -693,3 +693,14 @@ define i32 @test_extractvalue(%struct.ne
   %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
+}




More information about the llvm-commits mailing list