[PATCH] D134902: [clang] Implement -fstrict-flex-arrays=3

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 17 17:13:23 PDT 2022


dblaikie added inline comments.


================
Comment at: clang/test/CodeGen/bounds-checking-fam.c:2
 // REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -emit-llvm -triple x86_64 -fstrict-flex-arrays=0 -fsanitize=array-bounds        %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-0
-// RUN: %clang_cc1 -emit-llvm -triple x86_64 -fstrict-flex-arrays=0 -fsanitize=array-bounds -x c++ %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-0,CXX,CXX-STRICT-0
-// RUN: %clang_cc1 -emit-llvm -triple x86_64 -fstrict-flex-arrays=1 -fsanitize=array-bounds        %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-1
-// RUN: %clang_cc1 -emit-llvm -triple x86_64 -fstrict-flex-arrays=1 -fsanitize=array-bounds -x c++ %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-1,CXX
-// RUN: %clang_cc1 -emit-llvm -triple x86_64 -fstrict-flex-arrays=2 -fsanitize=array-bounds        %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-2
-// RUN: %clang_cc1 -emit-llvm -triple x86_64 -fstrict-flex-arrays=2 -fsanitize=array-bounds -x c++ %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-2,CXX
+// RUN: %clang_cc1 -O2 -emit-llvm -triple x86_64 -fstrict-flex-arrays=0 -fsanitize=array-bounds        %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-0
+// RUN: %clang_cc1 -O2 -emit-llvm -triple x86_64 -fstrict-flex-arrays=0 -fsanitize=array-bounds -x c++ %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT-0,CXX,CXX-STRICT-0
----------------
void wrote:
> serge-sans-paille wrote:
> > Why adding -02 here?
> Mostly because that's how Linux compiles its files. It also mirrors the test below. I'm not super married to it if you'd rather I omit it.
Yeah, generally Clang tests don't run LLVM optimizations - clang should be checking the output of Clang's IRGen, not the optimizations that LLVM performs.

Not sure how many Clang codegen tests disable llvm optimizations entirely, but that's basically/should be the default (-disable-llvm-optzns, I think that's the flag anyway).

If LLVM's output is so verbose it's hard to check reliably/non-brittally then maybe running some optimizations to simplify things might be acceptable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134902/new/

https://reviews.llvm.org/D134902



More information about the cfe-commits mailing list