diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-08-19 02:21:00 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-08-19 02:21:00 +0000 |
commit | b11cd6fbc583be97371d9cc6d95eec70de074630 (patch) | |
tree | 8a7fcb6178b1eca90f2ee184285fd8c3db624883 /llvm/lib/IR/Constants.cpp | |
parent | d8c60542a49b020eac3dc182189e3d595b3ad3bd (diff) | |
download | bcm5719-llvm-b11cd6fbc583be97371d9cc6d95eec70de074630.tar.gz bcm5719-llvm-b11cd6fbc583be97371d9cc6d95eec70de074630.zip |
IR: Fix ConstantArray::replaceUsesOfWithOnConstant()
Previously, `ConstantArray::replaceUsesOfWithOnConstant()` neglected to
check whether it becomes a `ConstantDataArray`. Call
`ConstantArray::getImpl()` to check for that.
llvm-svn: 215965
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index f0429ede820..c2c3c40df1c 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -2701,6 +2701,12 @@ void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To, return; } + // Check for any other type of constant-folding. + if (Constant *C = getImpl(getType(), Values)) { + replaceUsesOfWithOnConstantImpl(C); + return; + } + // Check to see if we have this array type already. LLVMContextImpl::ArrayConstantsTy::LookupKey Lookup( cast<ArrayType>(getType()), makeArrayRef(Values)); |