File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
llvm/lib/Transforms/Instrumentation Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -2638,12 +2638,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2638
2638
return false ;
2639
2639
2640
2640
unsigned NumArgOperands = I.getNumArgOperands ();
2641
- if (I.getIntrinsicID () == Intrinsic::abs) {
2642
- assert (NumArgOperands == 2 );
2643
- // The last argument is just a boolean flag.
2644
- NumArgOperands = 1 ;
2645
- }
2646
-
2647
2641
for (unsigned i = 0 ; i < NumArgOperands; ++i) {
2648
2642
Type *Ty = I.getArgOperand (i)->getType ();
2649
2643
if (Ty != RetTy)
@@ -3236,8 +3230,24 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
3236
3230
setOriginForNaryOp (I);
3237
3231
}
3238
3232
3233
+ // Instrument abs intrinsic.
3234
+ // handleUnknownIntrinsic can't handle it because of the last
3235
+ // is_int_min_poison argument which does not match the result type.
3236
+ void handleAbsIntrinsic (IntrinsicInst &I) {
3237
+ assert (I.getType ()->isIntOrIntVectorTy ());
3238
+ assert (I.getArgOperand (0 )->getType () == I.getType ());
3239
+
3240
+ // FIXME: Handle is_int_min_poison.
3241
+ IRBuilder<> IRB (&I);
3242
+ setShadow (&I, getShadow (&I, 0 ));
3243
+ setOrigin (&I, getOrigin (&I, 0 ));
3244
+ }
3245
+
3239
3246
void visitIntrinsicInst (IntrinsicInst &I) {
3240
3247
switch (I.getIntrinsicID ()) {
3248
+ case Intrinsic::abs:
3249
+ handleAbsIntrinsic (I);
3250
+ break ;
3241
3251
case Intrinsic::lifetime_start:
3242
3252
handleLifetimeStart (I);
3243
3253
break ;
You can’t perform that action at this time.
0 commit comments