diff options
author | Nikita Popov <npopov@redhat.com> | 2025-10-13 15:31:40 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2025-10-13 15:34:31 +0200 |
commit | 44463630f1660a75d6fa2fbfa5fc71f515e96139 (patch) | |
tree | 707ded7481b60a052770d39c4e1d0685bcb59489 /llvm/lib/IR/Constants.cpp | |
parent | c0fb07c2da6ac6f92c9afdefe4c4c5cc45287eb3 (diff) | |
download | llvm-44463630f1660a75d6fa2fbfa5fc71f515e96139.zip llvm-44463630f1660a75d6fa2fbfa5fc71f515e96139.tar.gz llvm-44463630f1660a75d6fa2fbfa5fc71f515e96139.tar.bz2 |
[Constants] Handle ptrtoaddr in getRelocationInfo()
Treat it the same way as ptrtoint.
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 2c2950c..cbce8bd 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -667,8 +667,11 @@ Constant::PossibleRelocationsTy Constant::getRelocationInfo() const { if (CE->getOpcode() == Instruction::Sub) { ConstantExpr *LHS = dyn_cast<ConstantExpr>(CE->getOperand(0)); ConstantExpr *RHS = dyn_cast<ConstantExpr>(CE->getOperand(1)); - if (LHS && RHS && LHS->getOpcode() == Instruction::PtrToInt && - RHS->getOpcode() == Instruction::PtrToInt) { + if (LHS && RHS && + (LHS->getOpcode() == Instruction::PtrToInt || + LHS->getOpcode() == Instruction::PtrToAddr) && + (RHS->getOpcode() == Instruction::PtrToInt || + RHS->getOpcode() == Instruction::PtrToAddr)) { Constant *LHSOp0 = LHS->getOperand(0); Constant *RHSOp0 = RHS->getOperand(0); |