[llvm] [InstCombine] Don't sink if it would require dropping deref assumptions. (PR #166945)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 11:36:02 PST 2025


================
@@ -5413,6 +5413,18 @@ bool InstCombinerImpl::tryToSinkInstruction(Instruction *I,
         return false;
   }
 
+  // Do not sink if there are dereferenceable assumes that would be removed.
+  for (User *User : I->users()) {
----------------
fhahn wrote:

Yep thanks, we can do better in `getOptionalSinkBlockForInst`, by just not skipping such assumes there we can still sink up to the deref assume. Also added some extra tests.

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


More information about the llvm-commits mailing list