[clang] 8dfac29 - [CodeGen] [riscv] Remove no-op ptr-to-ptr bitcasts (NFC)
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 14 16:11:58 PST 2023
Author: Benjamin Kramer
Date: 2023-11-15T01:09:23+01:00
New Revision: 8dfac290a441de21a24faccca6110bc738ebf1b7
URL: https://github.com/llvm/llvm-project/commit/8dfac290a441de21a24faccca6110bc738ebf1b7
DIFF: https://github.com/llvm/llvm-project/commit/8dfac290a441de21a24faccca6110bc738ebf1b7.diff
LOG: [CodeGen] [riscv] Remove no-op ptr-to-ptr bitcasts (NFC)
Added:
Modified:
clang/lib/CodeGen/CodeGenFunction.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 0f2b9055b88eb04..64521ce7182eee6 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -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)
@@ -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,
More information about the cfe-commits
mailing list