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

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 19:16:14 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)
----------------
dtcxzyw wrote:

Should be generalized to `Cond ? (A >> (BW - 1)) : 1 --> ZExt(Cond ? A < 0 : 1)`.

I am sorry I cannot give the approval for this patch if you cannot demonstrate that it benefits some real-world applications.


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


More information about the llvm-commits mailing list