[PATCH] D80368: Remove GlobalValue::getAlignment().

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 21 01:36:18 PDT 2020


efriedma created this revision.
efriedma added reviewers: arsenm, hfinkel, pcc, jdoerfert.
Herald added subscribers: kerbowa, steven.zhang, dexonsmith, steven_wu, kbarton, hiraditya, kristof.beyls, tpr, nhaehnle, wdng, jvesely, nemanjai.
Herald added a project: LLVM.

This function is deceptive at best; it's basically impossible to handle the return value correctly. If you have an arbitrary GlobalValue and you want to determine the alignment of that pointer, Value::getPointerAlignment() returns the correct value.  If you want the actual declared alignment of a function or variable, GlobalObject::getAlignment() returns that.

This patch switches all the users of GlobalValue::getAlignment() to an appropriate alternative.

There are target-specific changes to AArch64, AMDGPU, PowerPC, SystemZ, and XCore; the changes seem reasonable to me, but probably could use a second look.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80368

Files:
  llvm/include/llvm/CodeGen/AsmPrinter.h
  llvm/include/llvm/IR/GlobalObject.h
  llvm/include/llvm/IR/GlobalValue.h
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/IR/ConstantFold.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/Globals.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/LTO/LTOModule.cpp
  llvm/lib/Object/IRSymtab.cpp
  llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
  llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
  llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
  llvm/lib/Target/SystemZ/SystemZSubtarget.cpp
  llvm/lib/Target/XCore/XCoreISelLowering.cpp
  llvm/test/CodeGen/AArch64/funcptr_cast.ll
  llvm/test/CodeGen/AArch64/global-alignment.ll
  llvm/test/CodeGen/PowerPC/atomics-constant.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80368.265452.patch
Type: text/x-patch
Size: 18316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200521/39580b9a/attachment-0001.bin>


More information about the llvm-commits mailing list