[llvm] [InstCombine] Fold A pred C ? (A >> BW - 1) : 1 --> ZExt(A pred C ? A < 0 : 1) (PR #69961)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 19:49:59 PST 2024


================
@@ -3409,6 +3409,25 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
       return replaceOperand(SI, 2, S);
   }
 
+  {
+    // A pred C ? (A >> BW - 1) : 1 --> ZExt(A pred C ? A < 0 : 1)
----------------
goldsteinn wrote:

AFAICT the idea is that this is useful if `A pred C` implies something about `A < 0` in which case it makes sense to fold `A >> BW - 1` -> the more easy to reason about `A < 0`.
At least thats what it looks like the purpose is from the tests.

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


More information about the llvm-commits mailing list