diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp index a59248cc8c5..36115e96cf4 100644 --- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp +++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp @@ -553,10 +553,17 @@ static Value *cloneConstantExprWithNewAddressSpace( if (Value *NewOperand = ValueWithNewAddrSpace.lookup(Operand)) { IsNew = true; NewOperands.push_back(cast<Constant>(NewOperand)); - } else { - // Otherwise, reuses the old operand. - NewOperands.push_back(Operand); + continue; } + if (auto CExpr = dyn_cast<ConstantExpr>(Operand)) + if (Value *NewOperand = cloneConstantExprWithNewAddressSpace( + CExpr, NewAddrSpace, ValueWithNewAddrSpace)) { + IsNew = true; + NewOperands.push_back(cast<Constant>(NewOperand)); + continue; + } + // Otherwise, reuses the old operand. + NewOperands.push_back(Operand); } // If !IsNew, we will replace the Value with itself. However, replaced values |

