forked from OSchip/llvm-project
[CGP] Fix the detection of trivial case for addressing mode
The address can be presented as a bitcast of baseReg. In this case it is still trivial but OriginalValue != baseReg. llvm-svn: 316980
This commit is contained in:
parent
84286ce5dd
commit
f66a59ee88
|
@ -2751,17 +2751,16 @@ struct ExtAddrMode : public TargetLowering::AddrMode {
|
|||
return static_cast<FieldName>(Result);
|
||||
}
|
||||
|
||||
// AddrModes with a base reg or gv where the reg/gv is just the original
|
||||
// value are trivial.
|
||||
// AddrModes with a baseReg or gv where the reg/gv is
|
||||
// the only populated field are trivial.
|
||||
bool isTrivial() {
|
||||
bool Trivial = (BaseGV && BaseGV == OriginalValue) ||
|
||||
(BaseReg && BaseReg == OriginalValue);
|
||||
// If the AddrMode is trivial it shouldn't have an offset or be scaled.
|
||||
if (Trivial) {
|
||||
assert(BaseOffs == 0);
|
||||
assert(Scale == 0);
|
||||
}
|
||||
return Trivial;
|
||||
if (BaseGV && !BaseOffs && !Scale && !BaseReg)
|
||||
return true;
|
||||
|
||||
if (!BaseGV && !BaseOffs && !Scale && BaseReg)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue