@@ -3201,10 +3201,9 @@ llvm::Constant *CodeGenModule::EmitAnnotationArgs(const AnnotateAttr *Attr) {
3201
3201
" .args" );
3202
3202
GV->setSection (AnnotationSection);
3203
3203
GV->setUnnamedAddr (llvm::GlobalValue::UnnamedAddr::Global);
3204
- auto *Bitcasted = llvm::ConstantExpr::getBitCast (GV, GlobalsInt8PtrTy);
3205
3204
3206
- Lookup = Bitcasted ;
3207
- return Bitcasted ;
3205
+ Lookup = GV ;
3206
+ return GV ;
3208
3207
}
3209
3208
3210
3209
llvm::Constant *CodeGenModule::EmitAnnotateAttr (llvm::GlobalValue *GV,
@@ -3227,11 +3226,7 @@ llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV,
3227
3226
3228
3227
// Create the ConstantStruct for the global annotation.
3229
3228
llvm::Constant *Fields[] = {
3230
- llvm::ConstantExpr::getBitCast (GVInGlobalsAS, GlobalsInt8PtrTy),
3231
- llvm::ConstantExpr::getBitCast (AnnoGV, ConstGlobalsPtrTy),
3232
- llvm::ConstantExpr::getBitCast (UnitGV, ConstGlobalsPtrTy),
3233
- LineNoCst,
3234
- Args,
3229
+ GVInGlobalsAS, AnnoGV, UnitGV, LineNoCst, Args,
3235
3230
};
3236
3231
return llvm::ConstantStruct::getAnon (Fields);
3237
3232
}
@@ -4697,9 +4692,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, llvm::Type *Ty,
4697
4692
GV->takeName (Entry);
4698
4693
4699
4694
if (!Entry->use_empty ()) {
4700
- llvm::Constant *NewPtrForOldDecl =
4701
- llvm::ConstantExpr::getBitCast (GV, Entry->getType ());
4702
- Entry->replaceAllUsesWith (NewPtrForOldDecl);
4695
+ Entry->replaceAllUsesWith (GV);
4703
4696
}
4704
4697
4705
4698
Entry->eraseFromParent ();
@@ -4878,9 +4871,7 @@ llvm::GlobalVariable *CodeGenModule::CreateOrReplaceCXXRuntimeVariable(
4878
4871
GV->takeName (OldGV);
4879
4872
4880
4873
if (!OldGV->use_empty ()) {
4881
- llvm::Constant *NewPtrForOldDecl =
4882
- llvm::ConstantExpr::getBitCast (GV, OldGV->getType ());
4883
- OldGV->replaceAllUsesWith (NewPtrForOldDecl);
4874
+ OldGV->replaceAllUsesWith (GV);
4884
4875
}
4885
4876
4886
4877
OldGV->eraseFromParent ();
@@ -5766,8 +5757,7 @@ void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) {
5766
5757
// Remove it and replace uses of it with the alias.
5767
5758
GA->takeName (Entry);
5768
5759
5769
- Entry->replaceAllUsesWith (llvm::ConstantExpr::getBitCast (GA,
5770
- Entry->getType ()));
5760
+ Entry->replaceAllUsesWith (GA);
5771
5761
Entry->eraseFromParent ();
5772
5762
} else {
5773
5763
GA->setName (MangledName);
@@ -5845,8 +5835,7 @@ void CodeGenModule::emitIFuncDefinition(GlobalDecl GD) {
5845
5835
// Remove it and replace uses of it with the ifunc.
5846
5836
GIF->takeName (Entry);
5847
5837
5848
- Entry->replaceAllUsesWith (llvm::ConstantExpr::getBitCast (GIF,
5849
- Entry->getType ()));
5838
+ Entry->replaceAllUsesWith (GIF);
5850
5839
Entry->eraseFromParent ();
5851
5840
} else
5852
5841
GIF->setName (MangledName);
@@ -6042,9 +6031,6 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
6042
6031
llvm::Constant *Str =
6043
6032
llvm::ConstantExpr::getGetElementPtr (GV->getValueType (), GV, Zeros);
6044
6033
6045
- if (isUTF16)
6046
- // Cast the UTF16 string to the correct type.
6047
- Str = llvm::ConstantExpr::getBitCast (Str, Int8PtrTy);
6048
6034
Fields.add (Str);
6049
6035
6050
6036
// String length.
@@ -6414,8 +6400,7 @@ ConstantAddress CodeGenModule::GetAddrOfGlobalTemporary(
6414
6400
// replace it with the new global now.
6415
6401
llvm::Constant *&Entry = MaterializedGlobalTemporaryMap[E];
6416
6402
if (Entry) {
6417
- Entry->replaceAllUsesWith (
6418
- llvm::ConstantExpr::getBitCast (CV, Entry->getType ()));
6403
+ Entry->replaceAllUsesWith (CV);
6419
6404
llvm::cast<llvm::GlobalVariable>(Entry)->eraseFromParent ();
6420
6405
}
6421
6406
Entry = CV;
0 commit comments