[llvm] 16036f6 - [MemProf] Fix bot failure about missing return value along all paths

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 14:09:18 PDT 2023


Author: Teresa Johnson
Date: 2023-04-19T14:09:05-07:00
New Revision: 16036f6cc9c7787d940f51a947403e9c1ce24a64

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

LOG: [MemProf] Fix bot failure about missing return value along all paths

Fixes warning treated as error from
https://lab.llvm.org/buildbot/#/builders/13/builds/34440:
  'llvm::LibCallSimplifier::optimizeNew': not all control paths return a value
after a35206d78280e0ebcf48cd21bc5fff5c3b9c73fa.

Change assert in default case to a return nullptr, so we have a
reasonable fallback if invoked on a different library function, and no
longer get the above warning.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index fff326c941fe..d40eecaaf58f 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -1709,7 +1709,7 @@ Value *LibCallSimplifier::optimizeNew(CallInst *CI, IRBuilderBase &B,
         CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), B,
         TLI, LibFunc_ZnamSt11align_val_tRKSt9nothrow_t10hot_cold_t, HotCold);
   default:
-    assert(false);
+    return nullptr;
   }
 }
 


        


More information about the llvm-commits mailing list