Clean up a very silly use of first-class aggregates.

llvm-svn: 111777
This commit is contained in:
John McCall 2010-08-22 11:04:31 +00:00
parent a1dee5300b
commit c29eb8a9d1
2 changed files with 6 additions and 16 deletions

View File

@ -234,12 +234,6 @@ ItaniumCXXABI::EmitMemberFunctionPointerConversion(CodeGenFunction &CGF,
E->path_end());
if (!Adj) return Src;
llvm::Value *SrcPtr = Builder.CreateExtractValue(Src, 0, "src.ptr");
llvm::Value *SrcAdj = Builder.CreateExtractValue(Src, 1, "src.adj");
llvm::Value *Result = llvm::UndefValue::get(Src->getType());
Result = Builder.CreateInsertValue(Result, SrcPtr, 0);
// The this-adjustment is left-shifted by 1 on ARM.
if (IsARM) {
uint64_t Offset = cast<llvm::ConstantInt>(Adj)->getZExtValue();
@ -247,14 +241,14 @@ ItaniumCXXABI::EmitMemberFunctionPointerConversion(CodeGenFunction &CGF,
Adj = llvm::ConstantInt::get(Adj->getType(), Offset);
}
llvm::Value *SrcAdj = Builder.CreateExtractValue(Src, 1, "src.adj");
llvm::Value *DstAdj;
if (DerivedToBase)
DstAdj = Builder.CreateSub(SrcAdj, Adj, "adj");
else
DstAdj = Builder.CreateAdd(SrcAdj, Adj, "adj");
Result = Builder.CreateInsertValue(Result, DstAdj, 1);
return Result;
return Builder.CreateInsertValue(Src, DstAdj, 1);
}
llvm::Constant *

View File

@ -37,21 +37,17 @@ void f() {
vpa = 0;
// CHECK: [[TMP:%.*]] = load %0* @pa, align 8
// CHECK: [[TMPPTR:%.*]] = extractvalue %0 [[TMP]], 0
// CHECK: [[TMPADJ:%.*]] = extractvalue %0 [[TMP]], 1
// CHECK: [[RES0:%.*]] = insertvalue %0 undef, i64 [[TMPPTR]], 0
// CHECK: [[ADJ:%.*]] = add i64 [[TMPADJ]], 16
// CHECK: [[RES1:%.*]] = insertvalue %0 [[RES0]], i64 [[ADJ]], 1
// CHECK: store %0 [[RES1]], %0* @pc, align 8
// CHECK: [[RES:%.*]] = insertvalue %0 [[TMP]], i64 [[ADJ]], 1
// CHECK: store %0 [[RES]], %0* @pc, align 8
pc = pa;
// CHECK: [[TMP:%.*]] = load %0* @pc, align 8
// CHECK: [[TMPPTR:%.*]] = extractvalue %0 [[TMP]], 0
// CHECK: [[TMPADJ:%.*]] = extractvalue %0 [[TMP]], 1
// CHECK: [[RES0:%.*]] = insertvalue %0 undef, i64 [[TMPPTR]], 0
// CHECK: [[ADJ:%.*]] = sub i64 [[TMPADJ]], 16
// CHECK: [[RES1:%.*]] = insertvalue %0 [[RES0]], i64 [[ADJ]], 1
// CHECK: store %0 [[RES1]], %0* @pa, align 8
// CHECK: [[RES:%.*]] = insertvalue %0 [[TMP]], i64 [[ADJ]], 1
// CHECK: store %0 [[RES]], %0* @pa, align 8
pa = static_cast<void (A::*)()>(pc);
}