[llvm] [ConstantFolding] Support ptrtoaddr in cast folds (PR #162480)
Hongyu Chen via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 8 08:50:44 PDT 2025
================
@@ -1495,17 +1495,17 @@ Constant *llvm::ConstantFoldCastOperand(unsigned Opcode, Constant *C,
default:
llvm_unreachable("Missing case");
case Instruction::PtrToAddr:
- // TODO: Add some of the ptrtoint folds here as well.
- break;
case Instruction::PtrToInt:
if (auto *CE = dyn_cast<ConstantExpr>(C)) {
Constant *FoldedValue = nullptr;
// If the input is a inttoptr, eliminate the pair. This requires knowing
----------------
XChy wrote:
```suggestion
// If the input is an inttoptr, eliminate the pair. This requires knowing
```
https://github.com/llvm/llvm-project/pull/162480
More information about the llvm-commits
mailing list