[llvm] [CodeGen] Generalize trap emission after SP check fail (PR #109744)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 13:02:27 PDT 2024


================
@@ -3183,15 +3183,10 @@ SelectionDAGBuilder::visitSPDescriptorFailure(StackProtectorDescriptor &SPD) {
   SDValue Chain = TLI.makeLibCall(DAG, RTLIB::STACKPROTECTOR_CHECK_FAIL,
                                   MVT::isVoid, {}, CallOptions, getCurSDLoc())
                       .second;
-  // On PS4/PS5, the "return address" must still be within the calling
-  // function, even if it's at the very end, so emit an explicit TRAP here.
-  // Passing 'true' for doesNotReturn above won't generate the trap for us.
-  if (TM.getTargetTriple().isPS())
-    Chain = DAG.getNode(ISD::TRAP, getCurSDLoc(), MVT::Other, Chain);
-  // WebAssembly needs an unreachable instruction after a non-returning call,
-  // because the function return type can be different from __stack_chk_fail's
-  // return type (void).
----------------
arsenm wrote:

Should these comments be preserved somewhere? e.g. in the target code overriding the options? 

https://github.com/llvm/llvm-project/pull/109744


More information about the llvm-commits mailing list