[clang] [Clang] Allow devirtualization involving array subscripts with constant indices when the pointee type is known (PR #130528)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 18 06:20:12 PDT 2025


================
@@ -92,9 +92,9 @@ void fd(D d, XD xd, D *p) {
   // CHECK: call void %
   p[0].f();
 
-  // FIXME: We can devirtualize this, by C++1z [expr.add]/6 (if the array
-  // element type and the pointee type are not similar, behavior is undefined).
-  // CHECK: call void %
+  // By C++1z [expr.add]/6 (if the array element type and the pointee type
----------------
erichkeane wrote:

I don't get the comment on 89: Why can we virtualize this but not that one?

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


More information about the cfe-commits mailing list