[GlobalISel] Fix insertion of stack-protector epilogue
authorPetr Pavlu <petr.pavlu@arm.com>
Thu, 29 Nov 2018 13:22:53 +0000 (13:22 +0000)
committerPetr Pavlu <petr.pavlu@arm.com>
Thu, 29 Nov 2018 13:22:53 +0000 (13:22 +0000)
commit6bb80512db29c02ea149f63512d05be0939aaae7
treed60751159856f0c12f0cc6dbd4283f0f2e7abe15
parente6406d568c550dc27999d96d174f8fe354ab545a
[GlobalISel] Fix insertion of stack-protector epilogue

* Tell the StackProtector pass to generate the epilogue instrumentation
  when GlobalISel is enabled because GISel currently does not implement
  the same deferred epilogue insertion as SelectionDAG.
* Update StackProtector::InsertStackProtectors() to find a stack guard
  slot by searching for the llvm.stackprotector intrinsic when the
  prologue was not created by StackProtector itself but the pass still
  needs to generate the epilogue instrumentation. This fixes a problem
  when the pass would abort because the stack guard AllocInst pointer
  was null when generating the epilogue -- test
  CodeGen/AArch64/GlobalISel/arm64-irtranslator-stackprotect.ll.

Differential Revision: https://reviews.llvm.org/D54518

llvm-svn: 347862
llvm/lib/CodeGen/StackProtector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-stackprotect-check.ll [new file with mode: 0644]