[Internalize] Preserve __stack_chk_fail in Internalizer correctly
authorYuanfang Chen <yuanfang.chen@sony.com>
Thu, 28 Oct 2021 18:19:24 +0000 (11:19 -0700)
committerYuanfang Chen <yuanfang.chen@sony.com>
Thu, 28 Oct 2021 18:22:26 +0000 (11:22 -0700)
commitc18ed698733ac0cd338d8b5d048a77f4b34d88e6
treed2fe8b6b9d72f8e8d136333ab7597f49ad164e20
parent31a949fada877c5fe27d7d333d2a44e02f9239a5
[Internalize] Preserve __stack_chk_fail in Internalizer correctly

Move the section collecting `AlwaysPreserved` up before any
`maybeInternalize` is called. Otherwise, functions in `AlwaysPreserved` (in this case, `__stack_chk_fail`)
are not preserved.

Reviewed By: MaskRay, tejohnson

Differential Revision: https://reviews.llvm.org/D112684
llvm/lib/Transforms/IPO/Internalize.cpp
llvm/test/ThinLTO/X86/builtin-nostrip.ll