[llvm] [ConstantFold] Consider inttoptr, ptrtoaddr is valid cast pair (PR #161087)

Hongyu Chen via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 28 09:53:43 PDT 2025


================
@@ -2878,7 +2879,7 @@ unsigned CastInst::isEliminableCastPair(
     { 99,99,99, 2, 2,99,99, 8, 2,99,99,99, 4, 0}, // FPExt          |
     {  1, 0, 0,99,99, 0, 0,99,99,99,99, 7, 3, 0}, // PtrToInt       |
     {  1, 0, 0,99,99, 0, 0,99,99,99,99, 0, 3, 0}, // PtrToAddr      |
-    { 99,99,99,99,99,99,99,99,99,11,99,99,15, 0}, // IntToPtr       |
+    { 99,99,99,99,99,99,99,99,99,11, 0,99,15, 0}, // IntToPtr       |
----------------
XChy wrote:

Sorry, I only caught the possible extension in the description of #139357, instead of LangRef:
> ptrtoaddr only extracts (and then extends/truncates) the low index-width bits of the pointer
Fix it now.

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


More information about the llvm-commits mailing list