Index: lib/CodeGen/CodeGenPrepare.cpp =================================================================== --- lib/CodeGen/CodeGenPrepare.cpp +++ lib/CodeGen/CodeGenPrepare.cpp @@ -2727,17 +2727,15 @@ return static_cast(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 alone 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; } };