Skip to content

Commit

Permalink
[CodeGen] [riscv] Remove no-op ptr-to-ptr bitcasts (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
d0k committed Nov 15, 2023
1 parent a4f77f1 commit 8dfac29
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions clang/lib/CodeGen/CodeGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2486,10 +2486,8 @@ llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Function *AnnotationFn,
const AnnotateAttr *Attr) {
SmallVector<llvm::Value *, 5> Args = {
AnnotatedVal,
Builder.CreateBitCast(CGM.EmitAnnotationString(AnnotationStr),
ConstGlobalsPtrTy),
Builder.CreateBitCast(CGM.EmitAnnotationUnit(Location),
ConstGlobalsPtrTy),
CGM.EmitAnnotationString(AnnotationStr),
CGM.EmitAnnotationUnit(Location),
CGM.EmitAnnotationLineNo(Location),
};
if (Attr)
Expand All @@ -2499,15 +2497,10 @@ llvm::Value *CodeGenFunction::EmitAnnotationCall(llvm::Function *AnnotationFn,

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

Address CodeGenFunction::EmitFieldAnnotations(const FieldDecl *D,
Expand Down

0 comments on commit 8dfac29

Please sign in to comment.