[PATCH] D60837: [CGP] Look through bitcasts when duplicating returns for tail calls
Francis Visoiu Mistrih via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 23 14:31:06 PDT 2019
thegameg marked 4 inline comments as done.
thegameg 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);
----------------
spatel wrote:
> 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.
`Value::stripPointerCasts` seems to be doing similar things, so I used that here.
================
Comment at: llvm/test/CodeGen/X86/tailcall-cgp-dup.ll:110-112
+; CHECK-LABEL: f_ret8:
+; CHECK: jmp {{.*}}g_ret32
+; CHECK-NOT: call
----------------
spatel wrote:
> 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.
Thanks, I agree, this is much nicer.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60837/new/
https://reviews.llvm.org/D60837
More information about the llvm-commits
mailing list