[PATCH] D60837: [CGP] Look through bitcasts when duplicating returns for tail calls

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 12:52:24 PDT 2019


spatel added inline comments.


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:2035-2037
+      // Look through bitcasts.
+      if (BitCastInst *BCI = dyn_cast<BitCastInst>(IncomingVal))
+        IncomingVal = BCI->getOperand(0);
----------------
There is a peekThroughBitcast() util function in instcombine. Might be worth lifting to some common location, so we don't have to repeat it in other IR passes.


================
Comment at: llvm/test/CodeGen/X86/tailcall-cgp-dup.ll:110-112
+; CHECK-LABEL: f_ret8:
+; CHECK: jmp {{.*}}g_ret32
+; CHECK-NOT: call
----------------
It's nice to have a codegen test, but the transform occurs in IR, so I'd prefer to see an 'opt -codegenprepare' test for this too. Preferably, that test (and this test) would be added to trunk before this patch, so we just see the improvement here. Finally, I prefer that FileCheck assertions are auto-generated using the scripts in the llvm/utils folder.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60837/new/

https://reviews.llvm.org/D60837





More information about the llvm-commits mailing list