[PATCH] D111829: [Sanitizers] Replaced getMaxPointerSizeInBits with getPointerSizeInBits, which was causing failures for 32bit x86.

Kirill Stoimenov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 15 15:59:32 PDT 2021


kstoimenov marked 2 inline comments as done.
kstoimenov added inline comments.


================
Comment at: llvm/lib/Analysis/StackSafetyAnalysis.cpp:157
   TypeSize TS = DL.getTypeAllocSize(AI.getAllocatedType());
-  unsigned PointerSize = DL.getMaxPointerSizeInBits();
+  unsigned PointerSize = DL.getPointerSizeInBits();
   // Fallback to empty range for alloca size.
----------------
vitalybuka wrote:
> nikic wrote:
> > The pointer size depends on the address space, you probably want `DL.getPointerTypeSizeInBits(AI.getType())`.
> getPointerSizeInBits() should be fine but we need to checks that address space is default. I am not sure this analysis is true for alternative address spaces and current users also ignore non default ones.
I can change it back if you think getPointerSizeInBits() is the right approach. 


================
Comment at: llvm/lib/Analysis/StackSafetyAnalysis.cpp:756
+  uint32_t PointerSize =
+      Copy.begin()->first->getParent()->getDataLayout().getPointerSizeInBits();
   StackSafetyDataFlowAnalysis<GlobalValue> SSDFA(PointerSize, std::move(Copy));
----------------
I don't think we have access to AllocaInst here, right? I will keep it like this. 


================
Comment at: llvm/test/Analysis/StackSafetyAnalysis/i386-bug-fix.ll:1
+; RUN: opt passes="print-stack-safety" -disable-output -mtriple=i386-pc-linux-gnu %s 2>&1 | FileCheck %s --check-prefixes=CHECK
+
----------------
Added the test instructions, PTAL.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111829



More information about the llvm-commits mailing list