[llvm] [LLVM] Create `lf_alias` nodes for `typedef` and `using` (PR #153936)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 6 17:17:32 PDT 2025


================
@@ -0,0 +1,55 @@
+; ModuleID = 'typedef.cpp'
+source_filename = "typedef.cpp"
+target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.44.35214"
+
+@"?__purecall@@3PEAXEA" = dso_local global ptr null, align 8, !dbg !0
+
+; Function Attrs: mustprogress noinline norecurse nounwind optnone uwtable
+define dso_local noundef i32 @main() #0 !dbg !14 {
+entry:
+  %retval = alloca i32, align 4
+  %val = alloca i8, align 1
+  %val2 = alloca i64, align 8
+  store i32 0, ptr %retval, align 4
+    #dbg_declare(ptr %val, !19, !DIExpression(), !22)
+  store i8 15, ptr %val, align 1, !dbg !22
+    #dbg_declare(ptr %val2, !23, !DIExpression(), !26)
+  store i64 -1, ptr %val2, align 8, !dbg !26
+  ret i32 0, !dbg !27
+}
+
+attributes #0 = { mustprogress noinline norecurse nounwind optnone uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
----------------
Walnut356 wrote:

How necessary is this? It seems like a lot of effort for what should be an easy-to-generate-and-replace file. I'm not super familiar with llvm-ir, so this would probably end up being an hour or 2's work to save a few hundred bytes. Minimizing the YAML was as easy as extracting the two nodes I actually wanted, but this requires a ton of trial and error because I don't know what most of these tags mean or do. I need all the function information there so that we can test the local variables. Deleting any of the type info (`!6`, `!7`, `!8`, `!9`) means I need to modify the test because it rearranges the type info stream. It also means anyone who generates the file in the future also needs to know to make the same changes I did.

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


More information about the llvm-commits mailing list