[PATCH] D139395: Add CFI integer types normalization

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 31 10:22:47 PST 2023


pcc accepted this revision.
pcc added a comment.

LGTM with nits



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1694
+  getCXXABI().getMangleContext().mangleTypeName(
+      T, Out, !!getCodeGenOpts().SanitizeCfiICallNormalizeIntegers);
+
----------------
Is the !! necessary here?


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:6881
+    getCXXABI().getMangleContext().mangleTypeName(
+        T, Out, !!getCodeGenOpts().SanitizeCfiICallNormalizeIntegers);
+
----------------
Likewise


================
Comment at: clang/test/CodeGen/cfi-icall-normalize.c:55-75
+// CHECK: ![[TYPE0]] = !{i64 0, !"_ZTSFv{{u2i8|u2u8}}E.normalized"}
+// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFv{{u2i8S_|u2u8u2i8}}E.normalized"}
+// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFv{{u2i8S_S_|u2u8u2i8S0_}}E.normalized"}
+// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64}}E.normalized"}
+// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64}}S_E.normalized"}
+// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64}}S_S_E.normalized"}
+// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFv{{u3i32|u3i64}}E.normalized"}
----------------
Shouldn't these all be checking for specific types? Since you're specifying a triple, the width and signedness of the integer types are fixed.


================
Comment at: clang/test/CodeGen/cfi-icall-normalize2.c:9
+    // CHECK-SAME: {{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}}
+    // CHECK: call i1 @llvm.type.test({{i8\*|ptr}} {{%f|%0}}, metadata !"_ZTSFv{{u3i16|u3i32|u3i64}}E.normalized")
+    fn(arg);
----------------
Likewise; also below


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139395



More information about the cfe-commits mailing list