[PATCH] D131427: [ARM] Do not use LOAD_STACK_GUARD with ROPI/RWPI

Pengxuan Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 11:47:02 PDT 2022


pzheng added inline comments.


================
Comment at: llvm/test/CodeGen/ARM/stack-guard-rwpi.ll:1
+; RUN: llc -mtriple=arm-- --relocation-model=rwpi %s -o - | FileCheck %s
+
----------------
rengolin wrote:
> Perhaps add a second RUN line with another relocation model showing that you do see the stack guard?
> 
> Maybe even a third, for ROPI, just to make sure neither of them are removed by accident in the future.
Makes sense to me, will add two more RUN lines as you suggested.


================
Comment at: llvm/test/CodeGen/ARM/stack-guard-rwpi.ll:5
+;CHECK:        .LCPI0_0:
+;CHECK-NEXT:           .long   __stack_chk_guard(sbrel)
+define dso_local i32 @foo(i32 %t) nounwind sspstrong {
----------------
rengolin wrote:
> I'm not fully aware how the stack guard works in practice, is this an example of it not lowered?
Yes, this is an example of how the stack guard is lowered when LOAD_STACK_GUARD is not used. If LOAD_STACK_GUARD is used for rwpi/ropi (which is what this patch is trying to avoid), there is an assertion coming from lvm/lib/Target/ARM/ARMBaseInstrInfo.cpp.

void llvm::ARMBaseInstrInfo::expandLoadStackGuardBase(MachineBasicBlock::iterator, unsigned int, unsigned int) const: Assertion `!Subtarget.isROPI() && !Subtarget.isRWPI() && "ROPI/RWPI not currently supported with stack guard"' failed.

This patch basically prevents the assertion from happening since we already know ropi/rwpi are not supported with LOAD_STACK_GUARD yet .


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131427/new/

https://reviews.llvm.org/D131427



More information about the llvm-commits mailing list