@@ -154,9 +154,10 @@ FunctionPass *llvm::createHexagonQFPoptimizer() {
154154
155155bool HexagonQFPoptimizer::optimizeQfp (MachineInstr *MI,
156156 MachineBasicBlock *MBB) {
157-
157+
158158 // Early exit:
159- // - if instruction is invalid or has too few operands (QFP ops need 2 sources + 1 dest),
159+ // - if instruction is invalid or has too few operands (QFP ops need 2 sources
160+ // + 1 dest),
160161 // - is not part of the QFP instruction set,
161162 // - or does not have a transformation mapping.
162163 if (MI->getNumOperands () < 3 )
@@ -325,16 +326,16 @@ bool HexagonQFPoptimizer::runOnMachineFunction(MachineFunction &MF) {
325326 MachineInstr *MI = &*MII;
326327 ++MII; // As MI might be removed.
327328
328- if (llvm::find (QFPInst, MI->getOpcode ()) != QFPInst.end ())
329- if (MI->getOpcode () != Hexagon::V6_vconv_sf_qf32 &&
330- MI->getOpcode () != Hexagon::V6_vconv_hf_qf16) {
331- LLVM_DEBUG (dbgs () << " \n ###Analyzing for removal: " ; MI->dump ());
332- if (optimizeQfp (MI, MBB)) {
333- MI->eraseFromParent ();
334- LLVM_DEBUG (dbgs () << " \t ....Removing...." );
335- Changed = true ;
336- }
329+ if (QFPInstSet.count (MI->getOpcode ()) &&
330+ MI->getOpcode () != Hexagon::V6_vconv_sf_qf32 &&
331+ MI->getOpcode () != Hexagon::V6_vconv_hf_qf16) {
332+ LLVM_DEBUG (dbgs () << " \n ###Analyzing for removal: " ; MI->dump ());
333+ if (optimizeQfp (MI, MBB)) {
334+ MI->eraseFromParent ();
335+ LLVM_DEBUG (dbgs () << " \t ....Removing...." );
336+ Changed = true ;
337337 }
338+ }
338339 }
339340 ++MBBI;
340341 }
0 commit comments