[llvm] [AggressiveInstCombine] Guard memset with length in [0, 1] (PR #213240)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 22:20:30 PDT 2026


================
@@ -2462,6 +2464,37 @@ static bool foldMulHigh(Instruction &I) {
   return false;
 }
 
+/// Guard a memset whose nonconstant length is known to be in [0, 1].
+/// Inserts a conditional branch around the memset and specialises the
+/// executed path to a constant length of one.
+static bool foldMemSetZeroOrOneLength(MemSetInst *MI, const DataLayout &DL,
+                                      TargetLibraryInfo &TLI, DominatorTree &DT,
+                                      AssumptionCache &AC,
+                                      bool &MadeCFGChange) {
----------------
hsnaveen2u wrote:

Done

https://github.com/llvm/llvm-project/pull/213240


More information about the llvm-commits mailing list