[flang][codegen] Keep primitive type for extractvalue and insertvalue
authorValentin Clement <clementval@gmail.com>
Tue, 8 Feb 2022 20:26:16 +0000 (21:26 +0100)
committerValentin Clement <clementval@gmail.com>
Tue, 8 Feb 2022 20:26:38 +0000 (21:26 +0100)
commit9b5bb511adac5fc624dcaa8e25d0a09ad23577c3
tree4afdc1f7216fbd73821154a7ad32079d62b05db4
parent817d897b57c7f37d04c2a28153316efe3ae59ada
[flang][codegen] Keep primitive type for extractvalue and insertvalue

llvm.insertvalue and llvm.extractvalue need LLVM primitive type
for the indexing operands. While upstreaming the TargetRewrite pass the change
was made from i32 to index without knowing this restriction. This patch reverts
back the types used for indexing in the two ops created in this pass.

the error you will receive when lowering to LLVM IR with the current code
is the following:

```
 'llvm.insertvalue' op operand #1 must be primitive LLVM type, but got 'index'
```

Reviewed By: jeanPerier, schweitz

Differential Revision: https://reviews.llvm.org/D119253
flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
flang/test/Fir/target-rewrite-complex.fir