[PATCH] D77785: Use FrameIndexTy for stack protector

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 02:41:00 PDT 2020


arichardson created this revision.
arichardson added a reviewer: arsenm.
Herald added subscribers: llvm-commits, arphaman, hiraditya, wdng.
Herald added a project: LLVM.
arichardson edited the summary of this revision.

Using getValueType() is not correct for architectures extended with CHERI since
we need a pointer type and not the value that is loaded. While stack
protector is useless when you have CHERI (since CHERI provides much
stronger security guarantees), we still have a test to check that we can
generate correct code for checks. Merging b281138a1b67ca4405b77d774adc3de72742e7a2 <https://reviews.llvm.org/rGb281138a1b67ca4405b77d774adc3de72742e7a2>
into our tree broke this test. Fix by using TLI.getFrameIndexTy().


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77785

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -6385,7 +6385,7 @@
 
     int FI = FuncInfo.StaticAllocaMap[Slot];
     MFI.setStackProtectorIndex(FI);
-    EVT PtrTy = Src.getValueType();
+    EVT PtrTy = TLI.getFrameIndexTy(DAG.getDataLayout());
 
     SDValue FIN = DAG.getFrameIndex(FI, PtrTy);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77785.256219.patch
Type: text/x-patch
Size: 501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/2e734c2f/attachment.bin>


More information about the llvm-commits mailing list