diff options
author | Erich Keane <erich.keane@intel.com> | 2018-12-18 16:22:21 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-12-18 16:22:21 +0000 |
commit | 48047145f1044883b206d66e10ec76834e9fc850 (patch) | |
tree | 40ef0f10118afd441361a171313a38c5d76071c9 | |
parent | 411ea892eb0818c4d20c1273a02f57be7a39420e (diff) |
[NFC] Fix usage of Builder.insert(new Bitcast...)in CodeGenFunction
This is exactly a "CreateBitCast", so refactor this to get rid of a
'new'.
Note that this slightly changes the test, as the Builder is now
seemingly smart enough to fold one of the bitcasts into the annotation
call.
Change-Id: I1733fb1fdf91f5c9d88651067130b9a4e7b5ab67
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/annotations-field.c | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index f012384f3d2..123ece2cac7 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -2243,7 +2243,7 @@ Address CodeGenFunction::EmitFieldAnnotations(const FieldDecl *D, // annotation on the first field of a struct and annotation on the struct // itself. if (VTy != CGM.Int8PtrTy) - V = Builder.Insert(new llvm::BitCastInst(V, CGM.Int8PtrTy)); + V = Builder.CreateBitCast(V, CGM.Int8PtrTy); V = EmitAnnotationCall(F, V, I->getAnnotation(), D->getLocation()); V = Builder.CreateBitCast(V, VTy); } diff --git a/clang/test/CodeGen/annotations-field.c b/clang/test/CodeGen/annotations-field.c index 02bae15a2bc..27e64de7bbd 100644 --- a/clang/test/CodeGen/annotations-field.c +++ b/clang/test/CodeGen/annotations-field.c @@ -21,7 +21,6 @@ int main(int argc, char **argv) { // CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8) // CHECK-NEXT: bitcast i8* {{.*}} to i32* gf.v = argc; -// CHECK: bitcast i32* getelementptr inbounds (%struct.foo, %struct.foo* @gf, i32 0, i32 0) to i8* -// CHECK-NEXT: call i8* @llvm.ptr.annotation.p0i8({{.*}}str{{.*}}str{{.*}}i32 8) +// CHECK: call i8* @llvm.ptr.annotation.p0i8(i8* bitcast (%struct.foo* @gf to i8*), {{.*}}str{{.*}}str{{.*}}i32 8) return 0; } |