@@ -3021,33 +3021,40 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
30213021 // /
30223022 // / We special-case intrinsics where this approach fails. See llvm.bswap
30233023 // / handling as an example of that.
3024- bool handleUnknownIntrinsic (IntrinsicInst &I) {
3024+ bool handleUnknownIntrinsicUnlogged (IntrinsicInst &I) {
30253025 unsigned NumArgOperands = I.arg_size ();
3026+ if (NumArgOperands == 0 )
3027+ return false ;
30263028
3027- bool success = false ;
3028- if (NumArgOperands == 0 ) {
3029- // No-op
3030- } else if (NumArgOperands == 2 &&
3031- I.getArgOperand (0 )->getType ()->isPointerTy () &&
3032- I.getArgOperand (1 )->getType ()->isVectorTy () &&
3033- I.getType ()->isVoidTy () && !I.onlyReadsMemory ()) {
3029+ if (NumArgOperands == 2 && I.getArgOperand (0 )->getType ()->isPointerTy () &&
3030+ I.getArgOperand (1 )->getType ()->isVectorTy () &&
3031+ I.getType ()->isVoidTy () && !I.onlyReadsMemory ()) {
30343032 // This looks like a vector store.
3035- success = handleVectorStoreIntrinsic (I);
3036- } else if (NumArgOperands == 1 &&
3037- I.getArgOperand (0 )->getType ()->isPointerTy () &&
3038- I.getType ()->isVectorTy () && I.onlyReadsMemory ()) {
3033+ return handleVectorStoreIntrinsic (I);
3034+ }
3035+
3036+ if (NumArgOperands == 1 && I.getArgOperand (0 )->getType ()->isPointerTy () &&
3037+ I.getType ()->isVectorTy () && I.onlyReadsMemory ()) {
30393038 // This looks like a vector load.
3040- success = handleVectorLoadIntrinsic (I);
3041- } else if (I.doesNotAccessMemory ())
3042- success = maybeHandleSimpleNomemIntrinsic (I);
3039+ return handleVectorLoadIntrinsic (I);
3040+ }
3041+
3042+ if (I.doesNotAccessMemory ())
3043+ if (maybeHandleSimpleNomemIntrinsic (I))
3044+ return true ;
30433045
3044- if (success && ClDumpStrictIntrinsics)
3046+ // FIXME: detect and handle SSE maskstore/maskload
3047+ return false ;
3048+ }
3049+
3050+ bool handleUnknownIntrinsic (IntrinsicInst &I) {
3051+ bool success = handleUnknownIntrinsicUnlogged (I);
3052+ if (ClDumpStrictIntrinsics)
30453053 dumpInst (I);
30463054
30473055 LLVM_DEBUG (dbgs () << " UNKNOWN INTRINSIC HANDLED HEURISTICALLY: " << I
30483056 << " \n " );
30493057
3050- // FIXME: detect and handle SSE maskstore/maskload
30513058 return success;
30523059 }
30533060
0 commit comments