[clang-tools-extra] [llvm] [clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 14:36:21 PST 2023


================
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
       ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
     else
       ArrayLV = EmitLValue(Array);
+
     auto *Idx = EmitIdxAfterBase(/*Promote*/true);
 
+    if (SanOpts.has(SanitizerKind::ArrayBounds)) {
----------------
bwendling wrote:

Responding to your comment about emitting the base twice, this seems to be, if not common, at least not unusual. Given the proximity of the array subscript expr and the counted by checks, any duplicate base pointer loads are elided.

https://github.com/llvm/llvm-project/pull/73730


More information about the cfe-commits mailing list