[PATCH] D46789: [StackProtector] Don't crash when passing post-SP IR back in

Tim Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 12:05:33 PDT 2018


timshen added a comment.

To help myself recovering the memory better, I attempt to rephrase the problem:

- The IR pass StackProtector always generate the prologue, but not always generate the epilogue.
- Whether SDAG should generate the epilogue is indicated by StackProtector::shouldEmitSDCheck.
- During a re-run on llc, it doesn't matter whether we run StackProtector IR pass as part of the llc pipeline, the result is not expected. If we do run StackProtector, it inserts the prologue again; if we don't run StackProtector, StackProtector::shouldEmitSDCheck doesn't return the expected value, as the data members are not set.

If my memory recovey is successful and I understand the problem correctly, the best solution to me is to separate the mutation and analysis code in StackProtector. Suppose we split it into two passes "StackProtectorAnalysis" and "InsertStackProtectorPrologue", will it solve the problem? During the re-run, we only run StackProtectorAnalysis, but never again insert prologue. StackProtectorAnalysis should be kept as-is, without more special logic to detect whether the prologue is already generated (as this patch does). What do you think?


Repository:
  rL LLVM

https://reviews.llvm.org/D46789





More information about the llvm-commits mailing list