diff options
author | Serguei Katkov <serguei.katkov@azul.com> | 2017-11-20 05:42:36 +0000 |
---|---|---|
committer | Serguei Katkov <serguei.katkov@azul.com> | 2017-11-20 05:42:36 +0000 |
commit | 505359f705797548419bba8a849644db037bc027 (patch) | |
tree | 7f0aa3b6fa61fbec48929a382d185719019df252 /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 8e820552c387f46b2bbd6d51f3f7975e8d17fdb9 (diff) | |
download | bcm5719-llvm-505359f705797548419bba8a849644db037bc027.tar.gz bcm5719-llvm-505359f705797548419bba8a849644db037bc027.zip |
[CGP] Fix the crash caused by enable of complex addr mode
We must collect all AddModes even if they are the same.
This is due to Original value is different but we need all original
values collected as they are used as anchors in common phi finding.
Reviewers: john.brawn, reames
Reviewed By: john.brawn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D40166
llvm-svn: 318638
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index ebdb853a75c..e60e1e2d294 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -2800,15 +2800,11 @@ public: else if (DifferentField != ThisDifferentField) DifferentField = ExtAddrMode::MultipleFields; - // If this AddrMode is the same as all the others then everything is fine - // (which should only happen when there is actually only one AddrMode). - if (DifferentField == ExtAddrMode::NoField) { - assert(AddrModes.size() == 1); - return true; - } - // If NewAddrMode differs in only one dimension then we can handle it by - // inserting a phi/select later on. + // inserting a phi/select later on. Even if NewAddMode is the same + // we still need to collect it due to original value is different. + // And later we will need all original values as anchors during + // finding the common Phi node. if (DifferentField != ExtAddrMode::MultipleFields) { AddrModes.emplace_back(NewAddrMode); return true; @@ -2829,7 +2825,7 @@ public: return false; // A single AddrMode can trivially be combined. - if (AddrModes.size() == 1) + if (AddrModes.size() == 1 || DifferentField == ExtAddrMode::NoField) return true; // If the AddrModes we collected are all just equal to the value they are |