AArch64: Safely handle the incoming sret call argument.
authorAndrew Trick <atrick@apple.com>
Mon, 16 Feb 2015 18:10:47 +0000 (18:10 +0000)
committerAndrew Trick <atrick@apple.com>
Mon, 16 Feb 2015 18:10:47 +0000 (18:10 +0000)
commit4f7d60c1ea53cecc4bdb4bf6b8010ba9b7897bb8
tree66f741c1017ca6b3f1e80c5aa1526b59294ec797
parent793a52967be777faa3cf63756d333a909d27142e
AArch64: Safely handle the incoming sret call argument.

This adds a safe interface to the machine independent InputArg struct
for accessing the index of the original (IR-level) argument. When a
non-native return type is lowered, we generate the hidden
machine-level sret argument on-the-fly. Before this fix, we were
representing this argument as OrigArgIndex == 0, which is an outright
lie. In particular this crashed in the AArch64 backend where we
actually try to access the type of the original argument.

Now we use a sentinel value for machine arguments that have no
original argument index. AArch64, ARM, Mips, and PPC now check for this
case before accessing the original argument.

Fixes <rdar://19792160> Null pointer assertion in AArch64TargetLowering

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229413 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetCallingConv.h
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/Target/AArch64/AArch64ISelLowering.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/Mips/MipsCCState.cpp
lib/Target/Mips/MipsISelLowering.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/R600/R600ISelLowering.cpp
lib/Target/R600/SIISelLowering.cpp
test/CodeGen/AArch64/implicit-sret.ll [new file with mode: 0644]