[PATCH] D4608: Mangling for intrinsic names w/function type parameters

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 7 14:03:37 PDT 2016


pcc added a subscriber: pcc.

================
Comment at: llvm/trunk/lib/IR/Function.cpp:470
@@ +469,3 @@
+    if (!STyp->isLiteral())
+      Result += STyp->getName();
+    else
----------------
Sorry for the late review, but this mangling doesn't seem sound to me. It may fail in the presence of IR linking.

merge1.ll
```
%mystruct = type { i16, i16, [1 x i8*] }

declare <16 x %mystruct*> @llvm.masked.load.v16p0mystruct(<16 x %mystruct*>*, i32, <16 x i1>, <16 x %mystruct*>)

define void @foo() {
  %x = call <16 x %mystruct*> @llvm.masked.load.v16p0mystruct(<16 x %mystruct*>* undef, i32 undef, <16 x i1> undef, <16 x %mystruct*> undef)
  ret void
}
```

merge2.ll
```
%mystruct = type { i32, i16, [1 x i8*] }

declare <16 x %mystruct*> @llvm.masked.load.v16p0mystruct(<16 x %mystruct*>*, i32, <16 x i1>, <16 x %mystruct*>)

define void @bar() {
  %x = call <16 x %mystruct*> @llvm.masked.load.v16p0mystruct(<16 x %mystruct*>* undef, i32 undef, <16 x i1> undef, <16 x %mystruct*> undef)
  ret void
}
```

```$ ra/bin/llvm-link -o merge.bc merge1.ll merge2.ll
Intrinsic name not mangled correctly for type arguments! Should be: llvm.masked.load.v16p0mystruct.0
<16 x %mystruct.0*> (<16 x %mystruct.0*>*, i32, <16 x i1>, <16 x %mystruct.0*>)* @llvm.masked.load.v16p0mystruct
ra/bin/llvm-link: merge2.ll: error: input module is broken!
```


Repository:
  rL LLVM

http://reviews.llvm.org/D4608





More information about the llvm-commits mailing list