diff options
Diffstat (limited to 'llvm/lib/CodeGen/GlobalMergeFunctions.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/GlobalMergeFunctions.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/GlobalMergeFunctions.cpp b/llvm/lib/CodeGen/GlobalMergeFunctions.cpp index 470582885fab..e920b1be6822 100644 --- a/llvm/lib/CodeGen/GlobalMergeFunctions.cpp +++ b/llvm/lib/CodeGen/GlobalMergeFunctions.cpp @@ -60,11 +60,17 @@ static bool canParameterizeCallOperand(const CallBase *CI, unsigned OpIdx) { if (Name.starts_with("__dtrace")) return false; } - if (isCalleeOperand(CI, OpIdx) && - CI->getOperandBundle(LLVMContext::OB_ptrauth).has_value()) { + if (isCalleeOperand(CI, OpIdx)) { // The operand is the callee and it has already been signed. Ignore this // because we cannot add another ptrauth bundle to the call instruction. - return false; + if (CI->getOperandBundle(LLVMContext::OB_ptrauth).has_value()) + return false; + } else { + // The target of the arc-attached call must be a constant and cannot be + // parameterized. + if (CI->isOperandBundleOfType(LLVMContext::OB_clang_arc_attachedcall, + OpIdx)) + return false; } return true; } @@ -154,7 +160,7 @@ static Value *createCast(IRBuilder<> &Builder, Value *V, Type *DestTy) { auto *DestAT = dyn_cast<ArrayType>(DestTy); assert(DestAT); assert(SrcAT->getNumElements() == DestAT->getNumElements()); - Value *Result = UndefValue::get(DestTy); + Value *Result = PoisonValue::get(DestTy); for (unsigned int I = 0, E = SrcAT->getNumElements(); I < E; ++I) { Value *Element = createCast(Builder, Builder.CreateExtractValue(V, ArrayRef(I)), |
