[llvm] e3dac9e - [MSAN] Replace another open-coded convertToBool instance [nfc]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 10:25:12 PDT 2023


Author: Philip Reames
Date: 2023-03-15T10:24:49-07:00
New Revision: e3dac9e93fa5ce04f2be2900c352592940cdeee9

URL: https://github.com/llvm/llvm-project/commit/e3dac9e93fa5ce04f2be2900c352592940cdeee9
DIFF: https://github.com/llvm/llvm-project/commit/e3dac9e93fa5ce04f2be2900c352592940cdeee9.diff

LOG: [MSAN] Replace another open-coded convertToBool instance [nfc]

Note that getCleanShadow always returns Constant::getNullValue so the prior code is equivalent to convertToBool.

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 e4de395b33df..75cb9e0c0e63 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2364,9 +2364,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
           Constant *ConstOrigin = dyn_cast<Constant>(OpOrigin);
           // No point in adding something that might result in 0 origin value.
           if (!ConstOrigin || !ConstOrigin->isNullValue()) {
-            Value *FlatShadow = MSV->convertShadowToScalar(OpShadow, IRB);
-            Value *Cond =
-                IRB.CreateICmpNE(FlatShadow, MSV->getCleanShadow(FlatShadow));
+            Value *Cond = MSV->convertToBool(OpShadow, IRB);
             Origin = IRB.CreateSelect(Cond, OpOrigin, Origin);
           }
         }


        


More information about the llvm-commits mailing list