[PATCH] D30422: Keep attributes, calling convention, etc, when remangling intrinsic

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 12:05:33 PST 2017


sanjoy added inline comments.


================
Comment at: lib/IR/AutoUpgrade.cpp:1924
         "Unknown function for CallInst upgrade and isn't just a name change");
-    SmallVector<Value *, 4> Args(CI->arg_operands().begin(),
-                                 CI->arg_operands().end());
-    CI->replaceAllUsesWith(Builder.CreateCall(NewFn, Args));
-    CI->eraseFromParent();
+    CI->setCalledFunction(NewFn);
     return;
----------------
I think we also need to undo the name change.  Setting it and then unsetting it seems a bit hacky, perhaps we could have the switch create an unnamed `NewCI`, and outside it do:

```
if (NewCI != CI) {
  // Adjust names, and kill CI
}
```

(and remove the pre-rename)?


https://reviews.llvm.org/D30422





More information about the llvm-commits mailing list