[llvm] aff896d - [NFC][MSAN] Extract llvm.abs handling into a function
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 15:01:41 PDT 2020
Author: Vitaly Buka
Date: 2020-10-02T15:01:25-07:00
New Revision: aff896dea13fed04d79bbd1ce20d5e49fec720bc
URL: https://github.com/llvm/llvm-project/commit/aff896dea13fed04d79bbd1ce20d5e49fec720bc
DIFF: https://github.com/llvm/llvm-project/commit/aff896dea13fed04d79bbd1ce20d5e49fec720bc.diff
LOG: [NFC][MSAN] Extract llvm.abs handling into a function
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D88519
Added:
Modified:
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index cd54b6c2cd8f..df2144d206d5 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2638,12 +2638,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
return false;
unsigned NumArgOperands = I.getNumArgOperands();
- if (I.getIntrinsicID() == Intrinsic::abs) {
- assert(NumArgOperands == 2);
- // The last argument is just a boolean flag.
- NumArgOperands = 1;
- }
-
for (unsigned i = 0; i < NumArgOperands; ++i) {
Type *Ty = I.getArgOperand(i)->getType();
if (Ty != RetTy)
@@ -3236,8 +3230,24 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
setOriginForNaryOp(I);
}
+ // Instrument abs intrinsic.
+ // handleUnknownIntrinsic can't handle it because of the last
+ // is_int_min_poison argument which does not match the result type.
+ void handleAbsIntrinsic(IntrinsicInst &I) {
+ assert(I.getType()->isIntOrIntVectorTy());
+ assert(I.getArgOperand(0)->getType() == I.getType());
+
+ // FIXME: Handle is_int_min_poison.
+ IRBuilder<> IRB(&I);
+ setShadow(&I, getShadow(&I, 0));
+ setOrigin(&I, getOrigin(&I, 0));
+ }
+
void visitIntrinsicInst(IntrinsicInst &I) {
switch (I.getIntrinsicID()) {
+ case Intrinsic::abs:
+ handleAbsIntrinsic(I);
+ break;
case Intrinsic::lifetime_start:
handleLifetimeStart(I);
break;
More information about the llvm-commits
mailing list