Skip to content

Commit 8dfac29

Browse files
committed
[CodeGen] [riscv] Remove no-op ptr-to-ptr bitcasts (NFC)
1 parent a4f77f1 commit 8dfac29

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,10 +2486,8 @@ llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Function *AnnotationFn,
24862486
const AnnotateAttr *Attr) {
24872487
SmallVector<llvm::Value *, 5> Args = {
24882488
AnnotatedVal,
2489-
Builder.CreateBitCast(CGM.EmitAnnotationString(AnnotationStr),
2490-
ConstGlobalsPtrTy),
2491-
Builder.CreateBitCast(CGM.EmitAnnotationUnit(Location),
2492-
ConstGlobalsPtrTy),
2489+
CGM.EmitAnnotationString(AnnotationStr),
2490+
CGM.EmitAnnotationUnit(Location),
24932491
CGM.EmitAnnotationLineNo(Location),
24942492
};
24952493
if (Attr)
@@ -2499,15 +2497,10 @@ llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Function *AnnotationFn,
24992497

25002498
void CodeGenFunction::EmitVarAnnotations(const VarDecl *D, llvm::Value *V) {
25012499
assert(D->hasAttr<AnnotateAttr>() && "no annotate attribute");
2502-
// FIXME We create a new bitcast for every annotation because that's what
2503-
// llvm-gcc was doing.
2504-
unsigned AS = V->getType()->getPointerAddressSpace();
2505-
llvm::Type *I8PtrTy = Builder.getPtrTy(AS);
25062500
for (const auto *I : D->specific_attrs<AnnotateAttr>())
25072501
EmitAnnotationCall(CGM.getIntrinsic(llvm::Intrinsic::var_annotation,
2508-
{I8PtrTy, CGM.ConstGlobalsPtrTy}),
2509-
Builder.CreateBitCast(V, I8PtrTy, V->getName()),
2510-
I->getAnnotation(), D->getLocation(), I);
2502+
{V->getType(), CGM.ConstGlobalsPtrTy}),
2503+
V, I->getAnnotation(), D->getLocation(), I);
25112504
}
25122505

25132506
Address CodeGenFunction::EmitFieldAnnotations(const FieldDecl *D,

0 commit comments

Comments
 (0)