[llvm] [InstCombine] Support well-defined recurrences in isGuaranteedNotToBeUndefOrPoison (PR #150420)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 03:10:28 PDT 2025


================
@@ -986,6 +986,40 @@ exit:                                             ; preds = %loop
   ret void
 }
 
+; 'assume' says GEP ptr can't produce poison, check freeze is pushed to offset.
+define void @fold_phi_gep_phi_offset_assume(ptr %init, ptr %end, i64 %n) {
----------------
david-arm wrote:

Thanks for adding this test! I think it's also worth adding another test that's not part of a recurrence. In `pushFreezeToPreventPoisonFromPropagating` it's not specifically looking at PHIs, but any arbitrary instruction with N operands. For example, it should now help with cases like this - https://godbolt.org/z/aGhbh6MW1

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


More information about the llvm-commits mailing list