Skip to content

Commit b0afa6b

Browse files
committed
[clang] Change some placeholders from undef to poison [NFC]
1 parent 8e4423e commit b0afa6b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

clang/lib/CodeGen/CGExprComplex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ ComplexPairTy ComplexExprEmitter::VisitExpr(Expr *E) {
471471
CGF.ErrorUnsupported(E, "complex expression");
472472
llvm::Type *EltTy =
473473
CGF.ConvertType(getComplexType(E->getType())->getElementType());
474-
llvm::Value *U = llvm::UndefValue::get(EltTy);
474+
llvm::Value *U = llvm::PoisonValue::get(EltTy);
475475
return ComplexPairTy(U, U);
476476
}
477477

@@ -1449,7 +1449,7 @@ ComplexPairTy ComplexExprEmitter::VisitVAArgExpr(VAArgExpr *E) {
14491449
CGF.ErrorUnsupported(E, "complex va_arg expression");
14501450
llvm::Type *EltTy =
14511451
CGF.ConvertType(E->getType()->castAs<ComplexType>()->getElementType());
1452-
llvm::Value *U = llvm::UndefValue::get(EltTy);
1452+
llvm::Value *U = llvm::PoisonValue::get(EltTy);
14531453
return ComplexPairTy(U, U);
14541454
}
14551455

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ Value *ScalarExprEmitter::VisitExpr(Expr *E) {
18281828
CGF.ErrorUnsupported(E, "scalar expression");
18291829
if (E->getType()->isVoidType())
18301830
return nullptr;
1831-
return llvm::UndefValue::get(CGF.ConvertType(E->getType()));
1831+
return llvm::PoisonValue::get(CGF.ConvertType(E->getType()));
18321832
}
18331833

18341834
Value *

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
486486
if (IndirectBranch) {
487487
llvm::PHINode *PN = cast<llvm::PHINode>(IndirectBranch->getAddress());
488488
if (PN->getNumIncomingValues() == 0) {
489-
PN->replaceAllUsesWith(llvm::UndefValue::get(PN->getType()));
489+
PN->replaceAllUsesWith(llvm::PoisonValue::get(PN->getType()));
490490
PN->eraseFromParent();
491491
}
492492
}
@@ -1106,8 +1106,8 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
11061106
// Create a marker to make it easy to insert allocas into the entryblock
11071107
// later. Don't create this with the builder, because we don't want it
11081108
// folded.
1109-
llvm::Value *Undef = llvm::UndefValue::get(Int32Ty);
1110-
AllocaInsertPt = new llvm::BitCastInst(Undef, Int32Ty, "allocapt", EntryBB);
1109+
llvm::Value *Poison = llvm::PoisonValue::get(Int32Ty);
1110+
AllocaInsertPt = new llvm::BitCastInst(Poison, Int32Ty, "allocapt", EntryBB);
11111111

11121112
ReturnBlock = getJumpDestInCurrentScope("return");
11131113

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ void CodeGenModule::checkAliases() {
733733
for (const GlobalDecl &GD : Aliases) {
734734
StringRef MangledName = getMangledName(GD);
735735
llvm::GlobalValue *Alias = GetGlobalValue(MangledName);
736-
Alias->replaceAllUsesWith(llvm::UndefValue::get(Alias->getType()));
736+
Alias->replaceAllUsesWith(llvm::PoisonValue::get(Alias->getType()));
737737
Alias->eraseFromParent();
738738
}
739739
}
@@ -5572,7 +5572,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
55725572
}
55735573
} else {
55745574
ErrorUnsupported(D, "static initializer");
5575-
Init = llvm::UndefValue::get(getTypes().ConvertType(T));
5575+
Init = llvm::PoisonValue::get(getTypes().ConvertType(T));
55765576
}
55775577
} else {
55785578
Init = Initializer;

0 commit comments

Comments
 (0)