rsmith added a comment. Looks good, with a couple of tweaks (and corresponding test changes).
================ Comment at: lib/CodeGen/CGExprScalar.cpp:3910-3911 (Opcode == BO_Add) ? SAddIntrinsic : SMulIntrinsic, {LHS, RHS}); OffsetOverflows = Builder.CreateOr( OffsetOverflows, Builder.CreateExtractValue(ResultAndOverflow, 1)); return Builder.CreateExtractValue(ResultAndOverflow, 0); ---------------- Reverse the order of operands here; Builder will simplify `or` instructions with a constant RHS. ================ Comment at: lib/CodeGen/CGExprScalar.cpp:3963-3965 + ValidGEP = Builder.CreateAnd( + NoOffsetOverflow, + Builder.CreateSelect(PosOrZeroOffset, PosOrZeroValid, NegValid)); ---------------- Likewise reverse the operand order here.... ================ Comment at: lib/CodeGen/CGExprScalar.cpp:3967 + } else { + ValidGEP = Builder.CreateAnd(NoOffsetOverflow, PosOrZeroValid); + } ---------------- ... and here. https://reviews.llvm.org/D33910 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits