[PATCH] D136523: [MSAN] Add handleCountZeroes for vector versions of ctlz and cttz.

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 16:24:01 PDT 2022


vitalybuka accepted this revision.
vitalybuka added a comment.
This revision is now accepted and ready to land.

LGTM with nits



================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:2975
+    IRBuilder<> IRB(&I);
+    Value *Operand = I.getArgOperand(0);
+
----------------
Operand -> Src to match the name in LangRef


================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:2978
+    // Set the Output shadow based on input Shadow
+    Value *BoolShadow = IRB.CreateICmpNE(getShadow(Operand),
+                                         getCleanShadow(Operand), "_mscz_bs");
----------------
CreateIsNull like you do below is less code


================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:2983
+    assert(isa<Constant>(I.getOperand(1)));
+    Constant *constOperand = dyn_cast<Constant>(I.getOperand(1));
+    if (!constOperand->isZeroValue()) {
----------------
cast<> and it can be only the Constant
then you can remove assert() as cast<> already has one


================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:2983
+    assert(isa<Constant>(I.getOperand(1)));
+    Constant *constOperand = dyn_cast<Constant>(I.getOperand(1));
+    if (!constOperand->isZeroValue()) {
----------------
vitalybuka wrote:
> cast<> and it can be only the Constant
> then you can remove assert() as cast<> already has one
constOperant -> Poison (or something similar to the name in LangRef)
Note: vars are capitalized


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136523



More information about the llvm-commits mailing list