[llvm] [InstCombine][VectorCombine][NFC] Unify uses of lossless inverse cast (PR #156597)
    Yingwei Zheng via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Sep  3 09:52:25 PDT 2025
    
    
  
================
@@ -226,6 +226,26 @@ LLVM_ABI bool isMathLibCallNoop(const CallBase *Call,
 
 LLVM_ABI Constant *ReadByteArrayFromGlobal(const GlobalVariable *GV,
                                            uint64_t Offset);
-}
+
+struct PreservedCastFlags {
+  bool NNeg = false;
+  bool NUW = false;
+  bool NSW = false;
+};
+
+/// Try to cast C to InvC losslessly, satisfying CastOp(InvC) == C.
----------------
dtcxzyw wrote:
`CastOp(InvC) == C` is imprecise (e.g., `bitcast <2 x i16> <i16 0, i16 poison> to i32` is refined to 0).
https://github.com/llvm/llvm-project/pull/156597
    
    
More information about the llvm-commits
mailing list