summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp14
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
OpenPOWER on IntegriCloud