@@ -86,9 +86,9 @@ static void findUses(Value *V, Function &F,
86
86
// Create a wrapper function with type Ty that calls F (which may have a
87
87
// different type). Attempt to support common bitcasted function idioms:
88
88
// - Call with more arguments than needed: arguments are dropped
89
- // - Call with fewer arguments than needed: arguments are filled in with undef
89
+ // - Call with fewer arguments than needed: arguments are filled in with poison
90
90
// - Return value is not needed: drop it
91
- // - Return value needed but not present: supply an undef
91
+ // - Return value needed but not present: supply a poison value
92
92
//
93
93
// If the all the argument types of trivially castable to one another (i.e.
94
94
// I32 vs pointer type) then we don't create a wrapper at all (return nullptr
@@ -161,7 +161,7 @@ static Function *createWrapper(Function *F, FunctionType *Ty) {
161
161
162
162
if (WrapperNeeded && !TypeMismatch) {
163
163
for (; PI != PE; ++PI)
164
- Args.push_back (UndefValue ::get (*PI));
164
+ Args.push_back (PoisonValue ::get (*PI));
165
165
if (F->isVarArg ())
166
166
for (; AI != AE; ++AI)
167
167
Args.push_back (&*AI);
@@ -175,7 +175,7 @@ static Function *createWrapper(Function *F, FunctionType *Ty) {
175
175
ReturnInst::Create (M->getContext (), BB);
176
176
} else if (ExpectedRtnType->isVoidTy ()) {
177
177
LLVM_DEBUG (dbgs () << " Creating dummy return: " << *RtnType << " \n " );
178
- ReturnInst::Create (M->getContext (), UndefValue ::get (RtnType), BB);
178
+ ReturnInst::Create (M->getContext (), PoisonValue ::get (RtnType), BB);
179
179
} else if (RtnType == ExpectedRtnType) {
180
180
ReturnInst::Create (M->getContext (), Call, BB);
181
181
} else if (CastInst::isBitOrNoopPointerCastable (ExpectedRtnType, RtnType,
@@ -255,8 +255,8 @@ bool FixFunctionBitcasts::runOnModule(Module &M) {
255
255
if (shouldFixMainFunction (F.getFunctionType (), MainTy)) {
256
256
LLVM_DEBUG (dbgs () << " Found `main` function with incorrect type: "
257
257
<< *F.getFunctionType () << " \n " );
258
- Value *Args[] = {UndefValue ::get (MainArgTys[0 ]),
259
- UndefValue ::get (MainArgTys[1 ])};
258
+ Value *Args[] = {PoisonValue ::get (MainArgTys[0 ]),
259
+ PoisonValue ::get (MainArgTys[1 ])};
260
260
CallMain = CallInst::Create (MainTy, Main, Args, " call_main" );
261
261
Uses.push_back (std::make_pair (CallMain, &F));
262
262
}
0 commit comments