]> granicus.if.org Git - llvm/commit
[CGP] Look through bitcasts when duplicating returns for tail calls
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 23 Apr 2019 21:57:46 +0000 (21:57 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 23 Apr 2019 21:57:46 +0000 (21:57 +0000)
commita8196a8e047ea1d876cea71b7d5fcd6e6b6b3f56
tree904b59f6edbc8c56dc2624f9bf7efbb57534df46
parent7f2f10be2afc2766d6b9d701d67f0fbab6922424
[CGP] Look through bitcasts when duplicating returns for tail calls

The simple case of:

```
int *callee();
void *caller(void *a) {
  if (a == NULL)
    return callee();
  return a;
}
```

would generate a regular call instead of a tail call because we don't
look through the bitcast of the call to `callee` when duplicating the
return blocks.

Differential Revision: https://reviews.llvm.org/D60837

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359041 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CodeGenPrepare.cpp
test/CodeGen/X86/tailcall-cgp-dup.ll