[cfe-commits] r111777 - in /cfe/trunk: lib/CodeGen/ItaniumCXXABI.cpp test/CodeGenCXX/member-function-pointers.cpp
John McCall
rjmccall at apple.com
Sun Aug 22 04:04:31 PDT 2010
Author: rjmccall
Date: Sun Aug 22 06:04:31 2010
New Revision: 111777
URL: http://llvm.org/viewvc/llvm-project?rev=111777&view=rev
Log:
Clean up a very silly use of first-class aggregates.
Modified:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp
Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=111777&r1=111776&r2=111777&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Sun Aug 22 06:04:31 2010
@@ -234,12 +234,6 @@
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 @@
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 *
Modified: cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp?rev=111777&r1=111776&r2=111777&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp Sun Aug 22 06:04:31 2010
@@ -37,21 +37,17 @@
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);
}
More information about the cfe-commits
mailing list