[GlobalISel][CallLowering] Use hasRetAttr for return flags on CallBases
authorJessica Paquette <jpaquette@apple.com>
Thu, 29 Sep 2022 00:25:11 +0000 (17:25 -0700)
committerJessica Paquette <jpaquette@apple.com>
Thu, 29 Sep 2022 02:38:24 +0000 (19:38 -0700)
commit1eb49bbab6b65182f651ea96cfe076ac0d9191d7
tree2a1ae9799623c97687b060c77a7b7d59bfe5d146
parentccbb40147286e2e1996b2b7f089fc44f049c9d28
[GlobalISel][CallLowering] Use hasRetAttr for return flags on CallBases

Given something like this:

```
declare signext i16 @signext_callee()
define i32 @caller() {
  %res = call i16 @signext_callee()
  ...
}
```

CallLowering would miss that signext_callee's return value is sign extended,
because it isn't on the call.

Use hasRetAttr on the CallBase to allow us to catch this.

(This now inserts G_ASSERT_SEXT/G_ASSERT_ZEXT like in the original review.)

Differential Revision: https://reviews.llvm.org/D86228
llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/test/CodeGen/AArch64/GlobalISel/call-translator.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-call-return-values.ll