MaskRay added inline comments.
================ Comment at: clang/test/CodeGenCXX/fcheck-new.cpp:2 +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -fcheck-new -triple x86_64-linux-gnu -S -disable-O0-optnone \ +// RUN: -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s ---------------- heatd wrote: > MaskRay wrote: > > In this test, if I remove `-fcheck-new` , nothing will change. So this > > isn't a good test. > > > > I think we need something like: > > ``` > > struct A { A(); }; > > void *test0() { return A; } > > ``` > It will change (the attributes of _Znwm). > > From the test (with -fcheck-new): > ``` > [[CALL:%.*]] = call noalias noundef ptr @_Znwm(i64 noundef 4) > #[[ATTR2:[0-9]+]] > ``` > The same test (but without -fcheck-new, tested locally): > > ``` > %1 = tail call noalias noundef nonnull dereferenceable(4) ptr @_Znwm(i64 > noundef 4) #2 > ``` > > As you'll see, the non-fcheck-new has nonnull attached to _Znwm, while > -fcheck-new doesn't. This is exactly the behavior we want to test for. OK, you are right about `nonull`. I think my point still holds as with a constructor the effect will be more visible with a `new.notnull:` basic block. You may want to add another function to do `A *test1() { return new A; }` Also, with the simple IR, `opt -S -mem2reg ` is a no-op. You should remove it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125272/new/ https://reviews.llvm.org/D125272 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits