[PATCH] D19373: Remangle intrinsics names when types are renamed

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 10:07:29 PDT 2016


joker.eph added inline comments.

================
Comment at: lib/AsmParser/LLParser.cpp:223
@@ +222,3 @@
+        if (CallInst *CI = dyn_cast<CallInst>(U))
+          CI->setCalledFunction(Remangled.getValue());
+      F->eraseFromParent();
----------------
RAUW does not work at this point?

================
Comment at: lib/IR/Function.cpp:1050
@@ +1049,3 @@
+Optional<Function*> Intrinsic::remangleIntrinsicFunction(Function *F) {
+  Intrinsic::ID id = F->getIntrinsicID();
+  if (!id)
----------------
naming

================
Comment at: lib/IR/Function.cpp:1054
@@ +1053,3 @@
+
+  F->dump();
+
----------------
Guess you didn't want it here.

================
Comment at: lib/IR/Function.cpp:1069
@@ +1068,3 @@
+    for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
+      if (Intrinsic::matchIntrinsicType(FTy->getParamType(i), TableRef, ArgTys))
+        return None;
----------------
std::all_of

================
Comment at: lib/IR/Function.cpp:1079
@@ -1049,1 +1078,3 @@
+}
+
 /// hasAddressTaken - returns true if there are any uses of this function
----------------
There are two conceptually separated path IIUC:

1) old bitcode the intrinsic is *not* mangled and need to be mangled. This is the auto-upgrade path.
2) current bitcode has named type collision in the context and you need to remangle.

The fact that the remangling is shared is fine. However the conditions to reach this should be asserted better: the first path is valid only if the intrinsic was not mangled in the first place. The second path is valid only if the mismatch is because of a suffix added to the type.


http://reviews.llvm.org/D19373





More information about the llvm-commits mailing list