[PATCH] D29925: Implement intrinsic mangling for literal struct types.Fixes PR 31921

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 22:05:08 PST 2017


chandlerc added inline comments.


================
Comment at: lib/IR/Function.cpp:538
+    if (!STyp->isLiteral()) {
+      Result += STyp->getName();
+    } else {
----------------
Uh.... Am I the only one horrified that we didn't prefix this with anything?

Won't this cause types named 's...' to potentially collide with literal types? Yeah, pretty sure it will. It's not unique to literal types.

Let's take a look at:

  %i32 = type { i32 }

  define %i32* @test_struct(%i32* %v) gc "statepoint-example" {
  entry:
    %tok = call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0, %i32* %v)
    %v-new = call %i32* @llvm.experimental.gc.relocate.p0i32(token %tok,  i32 7, i32 7)
    ret %i32* %v-new
  }
  
  declare zeroext i1 @return_i1()
  declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
  declare %i32* @llvm.experimental.gc.relocate.p0i32(token, i32, i32)
  ;declare i32* @llvm.experimental.gc.relocate.p0i32(token, i32, i32)

Also, I think we need to ensure nested types are distinguishable here much like below with function types.


https://reviews.llvm.org/D29925





More information about the llvm-commits mailing list