[llvm] bbcfce4 - Use FrameIndexTy for stack protector

Alex Richardson via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 05:13:02 PDT 2020


Author: Alex Richardson
Date: 2020-04-23T13:12:27+01:00
New Revision: bbcfce4badac3dfeb64c1bb413bbe0dc53eca326

URL: https://github.com/llvm/llvm-project/commit/bbcfce4badac3dfeb64c1bb413bbe0dc53eca326
DIFF: https://github.com/llvm/llvm-project/commit/bbcfce4badac3dfeb64c1bb413bbe0dc53eca326.diff

LOG: Use FrameIndexTy for stack protector

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
into our tree broke this test. Fix by using TLI.getFrameIndexTy().

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D77785

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 38195e412623..51539f381887 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -6360,7 +6360,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
 
     int FI = FuncInfo.StaticAllocaMap[Slot];
     MFI.setStackProtectorIndex(FI);
-    EVT PtrTy = Src.getValueType();
+    EVT PtrTy = TLI.getFrameIndexTy(DAG.getDataLayout());
 
     SDValue FIN = DAG.getFrameIndex(FI, PtrTy);
 


        


More information about the llvm-commits mailing list