mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
[InstCombine] Canonicalize single element array store
Use the element type instead of the aggregate type. Differential Revision: http://reviews.llvm.org/D9591 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236969 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -880,6 +880,15 @@ static bool unpackStoreToAggregate(InstCombiner &IC, StoreInst &SI) {
|
||||
}
|
||||
}
|
||||
|
||||
if (auto *AT = dyn_cast<ArrayType>(T)) {
|
||||
// If the array only have one element, we unpack.
|
||||
if (AT->getNumElements() == 1) {
|
||||
V = IC.Builder->CreateExtractValue(V, 0);
|
||||
combineStoreToNewValue(IC, SI, V);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user