diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-02-17 00:32:19 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-02-17 00:32:19 +0000 |
| commit | c18b67745b0b2ad922954c4cfa3f5ca6b1b1e1e3 (patch) | |
| tree | f0b9acb6cafdc2abece60eaa87b4f34c9d91cfe0 /llvm/lib/Transforms | |
| parent | 89606869278eb0e71d40853fc3b91cb34b920df9 (diff) | |
| download | bcm5719-llvm-c18b67745b0b2ad922954c4cfa3f5ca6b1b1e1e3.tar.gz bcm5719-llvm-c18b67745b0b2ad922954c4cfa3f5ca6b1b1e1e3.zip | |
Bug 31948: Fix assertion when bitcasting constantexpr pointers
llvm-svn: 295387
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp index 8e1e0374576..96da4bf2e0d 100644 --- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp +++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp @@ -448,6 +448,12 @@ static Value *cloneConstantExprWithNewAddressSpace( return ConstantExpr::getBitCast(CE->getOperand(0), TargetType); } + if (CE->getOpcode() == Instruction::BitCast) { + if (Value *NewOperand = ValueWithNewAddrSpace.lookup(CE->getOperand(0))) + return ConstantExpr::getBitCast(cast<Constant>(NewOperand), TargetType); + return ConstantExpr::getAddrSpaceCast(CE, TargetType); + } + if (CE->getOpcode() == Instruction::Select) { Constant *Src0 = CE->getOperand(1); Constant *Src1 = CE->getOperand(2); |

