Issue 91848
Summary [Compiling Error][LiveIntervals.cpp] error: invalid use of incomplete type ‘const class llvm::TargetInstrInfo’
Labels new issue
Assignees
Reporter hlyix
    ![image](https://github.com/llvm/llvm-project/assets/31645239/5a09b448-c9b3-4c44-be8a-a41db4505902)

When I invoke function in TII like:
**bool test = TII->isTriviallyReMaterializable(MI);** (An example, no significance)
```
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp b/llvm/lib/CodeGen/LiveIntervals.cpp
index 68fff9bc221d..fd53728b54fa 100644
--- a/llvm/lib/CodeGen/LiveIntervals.cpp
+++ b/llvm/lib/CodeGen/LiveIntervals.cpp
@@ -517,6 +517,7 @@ bool LiveIntervals::computeDeadValues(LiveInterval &LI,
       if ((I == LI.begin() || std::prev(I)->end < Def) && !VNI->isPHIDef()) {
         MachineInstr *MI = getInstructionFromIndex(Def);
         MI->setRegisterDefReadUndef(VReg);
+        bool test = TII->isTriviallyReMaterializable(MI);
       }
     }
```


it results in compiling error below:
![image](https://github.com/llvm/llvm-project/assets/31645239/695d7a65-99ef-49bd-bef9-f8b60ed82fa0)


**Solution:**
include
`#include "llvm/CodeGen/TargetInstrInfo.h"`
in
`llvm/include/llvm/CodeGen/LiveIntervals.h`
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to