[PATCH] D146208: [ASAN] Support memory checks on vp.load/store.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 10:58:42 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1477
+    if (IntptrTy->getPrimitiveSizeInBits() < EVLType->getPrimitiveSizeInBits())
+      EVL = IB.CreateTrunc(EVL, IntptrTy);
+    else if (IntptrTy->getPrimitiveSizeInBits() >
----------------
Can we use IB.CreateZExtOrTrunc(EVL, IntptrTy) and remove the ifs?


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1481
+      EVL = IB.CreateZExt(EVL, IntptrTy);
+    // To avoid undefined behavior for extacting with out of range index, use
+    // the minimum of evl and element count as trip count.
----------------
extacting -> extracting


================
Comment at: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:1670
+  for (unsigned Idx = 0; Idx < Num; ++Idx) {
+    IRB.SetInsertPoint(InsertBefore);
+    Func(IRB, ConstantInt::get(Ty, Idx));
----------------
Why do we need to keep setting the insertion point every iteration? Will that cause the last index to be checked first?

Is there a test case for constant evl. I didn't see one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146208



More information about the llvm-commits mailing list