diff options
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
-rw-r--r-- | llvm/lib/IR/Value.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index 28263ede39d..38eed76fe45 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -648,16 +648,10 @@ unsigned Value::getPointerAlignment(const DataLayout &DL) const { unsigned Align = 0; if (auto *GO = dyn_cast<GlobalObject>(this)) { - if (isa<Function>(GO)) { - switch (DL.getFunctionPtrAlignType()) { - case DataLayout::FunctionPtrAlignType::Independent: - return DL.getFunctionPtrAlign(); - case DataLayout::FunctionPtrAlignType::MultipleOfFunctionAlign: - return std::max(DL.getFunctionPtrAlign(), GO->getAlignment()); - default: - llvm_unreachable("unknown function pointer align type"); - } - } + // Don't make any assumptions about function pointer alignment. Some + // targets use the LSBs to store additional information. + if (isa<Function>(GO)) + return 0; Align = GO->getAlignment(); if (Align == 0) { if (auto *GVar = dyn_cast<GlobalVariable>(GO)) { |