[llvm] [InstCombine][VectorCombine][NFC] Unify uses of lossless inverse cast (PR #156597)

Hongyu Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 3 10:36:29 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.
----------------
XChy wrote:

Good catch. What about `CastOp(InvC) == C or CastOp(InvC) is one of the possible values of C if C is undefined`

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


More information about the llvm-commits mailing list