[PATCH] D72331: OpaquePtr: add type to inalloca attribute.

Tim Northover via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 7 06:09:40 PST 2020


t.p.northover created this revision.
t.p.northover added a reviewer: dblaikie.
Herald added subscribers: luismarques, apazos, sameer.abuasal, pzheng, s.egerton, lenary, Jim, jsji, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, atanasyan, edward-jones, zzheng, MaskRay, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, fedor.sergeev, kbarton, aheejin, hiraditya, jgravelle-google, sbc100, nhaehnle, jvesely, nemanjai, sdardis, mcrosier, jyknight, dschuff, arsenm, jholewinski.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added projects: clang, LLVM.

Similarly to byval, the inalloca aergument attribute (for MSVC compatibility) currently works by looking at the pointee type of its argument. This is no longer going to work with opaque pointers, and needs to be adapted reasonably early to allow any front-ends time to upgrade their usage.

So this patch adds an optional type, pretty much following byval's implementation directly from last year, so that part is probably pretty straightforward.

What might be worth thinking about is just where we enforce that byval and inalloca are incompatible. The situation I eneded up with was:

- AttrBuilder allows you to create an AttributeSet with both (as before, but needed a new Type field to implement).
- IR: they can exist together (as before)
- Verifier: complains about IR in that state (as before).
- CodeGen: shoves everything into a single "type" and "align" field. As before, but I've renamed them to be a bit more use-case agnostic in this patch.

I think that mostly makes sense, except possibly for the AttrBuilder. It might instead make sense to assert if someone tries to create a set with both.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72331

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp
  clang/test/CodeGenCXX/inheriting-constructor.cpp
  clang/test/CodeGenCXX/microsoft-abi-arg-order.cpp
  clang/test/CodeGenCXX/microsoft-abi-byval-sret.cpp
  clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp
  clang/test/CodeGenCXX/microsoft-abi-byval-vararg.cpp
  clang/test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp
  clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
  clang/test/CodeGenCXX/microsoft-abi-vmemptr-conflicts.cpp
  clang/test/CodeGenCXX/microsoft-abi-vtables-multiple-nonvirtual-inheritance-this-adjustment.cpp
  clang/test/CodeGenCXX/vararg-non-pod-ms-compat.cpp
  clang/test/CodeGenObjCXX/arc-indirect.mm
  clang/test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm
  llvm/include/llvm/CodeGen/TargetCallingConv.h
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/include/llvm/IR/Argument.h
  llvm/include/llvm/IR/Attributes.h
  llvm/include/llvm/IR/CallSite.h
  llvm/include/llvm/IR/Function.h
  llvm/include/llvm/IR/InstrTypes.h
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/AsmParser/LLParser.h
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
  llvm/lib/CodeGen/CallingConvLower.cpp
  llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
  llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/lib/CodeGen/TargetLoweringBase.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/IR/AttributeImpl.h
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/Core.cpp
  llvm/lib/IR/Function.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
  llvm/lib/Target/Lanai/LanaiISelLowering.cpp
  llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
  llvm/lib/Target/Mips/MipsISelLowering.cpp
  llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.h
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/Sparc/SparcISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/X86/X86FastISel.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/lib/Target/XCore/XCoreISelLowering.cpp
  llvm/lib/Transforms/Utils/ValueMapper.cpp
  llvm/test/Assembler/inalloca-type-attr.ll
  llvm/test/Assembler/invalid-inalloca-type1.ll
  llvm/test/Assembler/invalid-inalloca-type2.ll
  llvm/test/Assembler/invalid-inalloca-type3.ll
  llvm/test/Bitcode/attributes.ll
  llvm/test/Bitcode/compatibility-3.6.ll
  llvm/test/Bitcode/compatibility-3.7.ll
  llvm/test/Bitcode/compatibility-3.8.ll
  llvm/test/Bitcode/compatibility-3.9.ll
  llvm/test/Bitcode/compatibility-4.0.ll
  llvm/test/Bitcode/compatibility-5.0.ll
  llvm/test/Bitcode/compatibility-6.0.ll
  llvm/test/Bitcode/compatibility.ll
  llvm/test/Bitcode/inalloca.ll
  llvm/test/Transforms/Attributor/ArgumentPromotion/inalloca.ll
  llvm/test/Transforms/Attributor/readattrs.ll
  llvm/test/Transforms/Attributor/value-simplify.ll
  llvm/test/Transforms/FunctionAttrs/readattrs.ll
  llvm/test/Transforms/InstCombine/stacksaverestore.ll
  llvm/unittests/IR/AttributesTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72331.236568.patch
Type: text/x-patch
Size: 103680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200107/b36b653b/attachment-0001.bin>


More information about the cfe-commits mailing list