OSDN Git Service

[AArch64][GlobalISel] Fix llvm.returnaddress(0) selection when LR is clobbered.
authorAmara Emerson <aemerson@apple.com>
Wed, 22 Jan 2020 06:38:02 +0000 (22:38 -0800)
committerAmara Emerson <aemerson@apple.com>
Wed, 22 Jan 2020 06:53:32 +0000 (22:53 -0800)
commit2e25d75aaa2280c3128c8dd6349f8b605207b94d
tree0662c2072f0f701f9795ab5fb161bf8b7c55e6de
parent97d000da2e6025600c4709d611e853eb1d5d407c
[AArch64][GlobalISel] Fix llvm.returnaddress(0) selection when LR is clobbered.

The code was originally ported from SelectionDAG, which does CSE behind the scenes
automatically. When copying the return address from LR live into the function, we
need to make sure to use the single copy on function entry. Any later copy from LR
could be using clobbered junk.

Implement this by caching the copy in the per-MF state in the selector.

Should hopefully fix the AArch64 sanitiser buildbot failure.
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/select-returnaddr.ll