Skip to content

Commit 562d63e

Browse files
committed
Move away from deprecated ctor and remove gnu std from test
Signed-off-by: Steffen Larsen <steffen.larsen@intel.com>
1 parent 725823f commit 562d63e

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,25 +2739,19 @@ Address CodeGenFunction::EmitFieldSYCLAnnotations(const FieldDecl *D,
27392739
assert(SYCLAnnotAttr && "no add_ir_annotations_member attribute");
27402740
llvm::Value *V = Addr.getPointer();
27412741
llvm::Type *VTy = V->getType();
2742-
2743-
// llvm.ptr.annotation intrinsic accepts a pointer to integer of any width -
2744-
// don't perform bitcasts if value is integer.
2745-
if (VTy->getPointerElementType()->isIntegerTy()) {
2746-
llvm::Function *F = CGM.getIntrinsic(llvm::Intrinsic::ptr_annotation, VTy);
2747-
V = EmitSYCLAnnotationCall(F, V, D->getLocation(), SYCLAnnotAttr);
2748-
return Address::deprecated(V, Addr.getAlignment());
2749-
}
2750-
27512742
auto *PTy = dyn_cast<llvm::PointerType>(VTy);
27522743
unsigned AS = PTy ? PTy->getAddressSpace() : 0;
2753-
llvm::PointerType *IntrinTy =
2754-
llvm::PointerType::getWithSamePointeeType(CGM.Int8PtrTy, AS);
2744+
llvm::Type *IntrType = VTy;
2745+
if (!VTy->getPointerElementType()->isIntegerTy())
2746+
IntrType = llvm::PointerType::getWithSamePointeeType(CGM.Int8PtrTy, AS);
27552747
llvm::Function *F =
2756-
CGM.getIntrinsic(llvm::Intrinsic::ptr_annotation, IntrinTy);
2748+
CGM.getIntrinsic(llvm::Intrinsic::ptr_annotation, IntrType);
27572749

2758-
V = Builder.CreateBitCast(V, IntrinTy);
2750+
if (VTy != IntrType)
2751+
V = Builder.CreateBitCast(V, IntrType);
27592752
V = EmitSYCLAnnotationCall(F, V, D->getLocation(), SYCLAnnotAttr);
2760-
V = Builder.CreateBitCast(V, VTy);
2753+
if (VTy != IntrType)
2754+
V = Builder.CreateBitCast(V, VTy);
27612755
return Address(V, Addr.getElementType(), Addr.getAlignment());
27622756
}
27632757

clang/test/AST/ast-attr-add-ir-annotations-pack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: not %clang_cc1 -fsycl-is-device -std=gnu++11 -ast-dump %s | FileCheck %s
1+
// RUN: not %clang_cc1 -fsycl-is-device -ast-dump %s | FileCheck %s
22

33
// Tests the AST produced from instantiating templates using the
44
// __sycl_detail__::add_ir_annotations_member attribute with pack expansion

0 commit comments

Comments
 (0)