Lines Matching full:instruction

22 // fit more values in one vectorized instruction. In addition, this optimization
34 #include "llvm/IR/Instruction.h"
46 /// Given an instruction and a container, it fills all the relevant operands of
47 /// that instruction, with respect to the Trunc expression graph optimizaton.
48 static void getRelevantOperands(Instruction *I, SmallVectorImpl<Value *> &Ops) { in getRelevantOperands()
51 case Instruction::Trunc: in getRelevantOperands()
52 case Instruction::ZExt: in getRelevantOperands()
53 case Instruction::SExt: in getRelevantOperands()
57 case Instruction::Add: in getRelevantOperands()
58 case Instruction::Sub: in getRelevantOperands()
59 case Instruction::Mul: in getRelevantOperands()
60 case Instruction::And: in getRelevantOperands()
61 case Instruction::Or: in getRelevantOperands()
62 case Instruction::Xor: in getRelevantOperands()
63 case Instruction::Shl: in getRelevantOperands()
64 case Instruction::LShr: in getRelevantOperands()
65 case Instruction::AShr: in getRelevantOperands()
66 case Instruction::UDiv: in getRelevantOperands()
67 case Instruction::URem: in getRelevantOperands()
68 case Instruction::InsertElement: in getRelevantOperands()
72 case Instruction::ExtractElement: in getRelevantOperands()
75 case Instruction::Select: in getRelevantOperands()
79 case Instruction::PHI: in getRelevantOperands()
90 SmallVector<Instruction *, 8> Stack; in buildTruncExpressionGraph()
104 auto *I = dyn_cast<Instruction>(Curr); in buildTruncExpressionGraph()
109 // Already handled all instruction operands, can remove it from both the in buildTruncExpressionGraph()
110 // Worklist and the Stack, and add it to the instruction info map. in buildTruncExpressionGraph()
123 // Add the instruction to the stack before start handling its operands. in buildTruncExpressionGraph()
128 case Instruction::Trunc: in buildTruncExpressionGraph()
129 case Instruction::ZExt: in buildTruncExpressionGraph()
130 case Instruction::SExt: in buildTruncExpressionGraph()
136 case Instruction::Add: in buildTruncExpressionGraph()
137 case Instruction::Sub: in buildTruncExpressionGraph()
138 case Instruction::Mul: in buildTruncExpressionGraph()
139 case Instruction::And: in buildTruncExpressionGraph()
140 case Instruction::Or: in buildTruncExpressionGraph()
141 case Instruction::Xor: in buildTruncExpressionGraph()
142 case Instruction::Shl: in buildTruncExpressionGraph()
143 case Instruction::LShr: in buildTruncExpressionGraph()
144 case Instruction::AShr: in buildTruncExpressionGraph()
145 case Instruction::UDiv: in buildTruncExpressionGraph()
146 case Instruction::URem: in buildTruncExpressionGraph()
147 case Instruction::InsertElement: in buildTruncExpressionGraph()
148 case Instruction::ExtractElement: in buildTruncExpressionGraph()
149 case Instruction::Select: { in buildTruncExpressionGraph()
155 case Instruction::PHI: { in buildTruncExpressionGraph()
177 SmallVector<Instruction *, 8> Stack; in getMinBitWidth()
189 InstInfoMap[cast<Instruction>(Src)].ValidBitWidth = TruncBitWidth; in getMinBitWidth()
199 // Otherwise, it must be an instruction. in getMinBitWidth()
200 auto *I = cast<Instruction>(Curr); in getMinBitWidth()
208 // Already handled all instruction operands, can remove it from both, the in getMinBitWidth()
213 if (auto *IOp = dyn_cast<Instruction>(Operand)) in getMinBitWidth()
219 // Add the instruction to the stack before start handling its operands. in getMinBitWidth()
224 // when the instruction is part of a loop. in getMinBitWidth()
228 if (auto *IOp = dyn_cast<Instruction>(Operand)) { in getMinBitWidth()
239 unsigned MinBitWidth = InstInfoMap.lookup(cast<Instruction>(Src)).MinBitWidth; in getMinBitWidth()
254 // In this case the expression can be evaluated with the trunc instruction in getMinBitWidth()
255 // destination type, and trunc instruction can be omitted. However, we in getMinBitWidth()
272 // post-dominated by the trunc instruction, i.e., were visited during the in getBestTruncatedType()
276 Instruction *I = Itr.first; in getBestTruncatedType()
281 if (auto *UI = dyn_cast<Instruction>(U)) in getBestTruncatedType()
308 Instruction *I = Itr.first; in getBestTruncatedType()
316 if (I->getOpcode() == Instruction::LShr) { in getBestTruncatedType()
321 if (I->getOpcode() == Instruction::AShr) { in getBestTruncatedType()
329 if (I->getOpcode() == Instruction::UDiv || in getBestTruncatedType()
330 I->getOpcode() == Instruction::URem) { in getBestTruncatedType()
374 auto *I = cast<Instruction>(V); in getReducedOperand()
385 Instruction *I = Itr.first; in ReduceExpressionGraph()
388 assert(!NodeInfo.NewValue && "Instruction has been evaluated"); in ReduceExpressionGraph()
394 case Instruction::Trunc: in ReduceExpressionGraph()
395 case Instruction::ZExt: in ReduceExpressionGraph()
396 case Instruction::SExt: { in ReduceExpressionGraph()
409 Opc == Instruction::SExt); in ReduceExpressionGraph()
426 case Instruction::Add: in ReduceExpressionGraph()
427 case Instruction::Sub: in ReduceExpressionGraph()
428 case Instruction::Mul: in ReduceExpressionGraph()
429 case Instruction::And: in ReduceExpressionGraph()
430 case Instruction::Or: in ReduceExpressionGraph()
431 case Instruction::Xor: in ReduceExpressionGraph()
432 case Instruction::Shl: in ReduceExpressionGraph()
433 case Instruction::LShr: in ReduceExpressionGraph()
434 case Instruction::AShr: in ReduceExpressionGraph()
435 case Instruction::UDiv: in ReduceExpressionGraph()
436 case Instruction::URem: { in ReduceExpressionGraph()
439 Res = Builder.CreateBinOp((Instruction::BinaryOps)Opc, LHS, RHS); in ReduceExpressionGraph()
442 if (auto *ResI = dyn_cast<Instruction>(Res)) in ReduceExpressionGraph()
446 case Instruction::ExtractElement: { in ReduceExpressionGraph()
452 case Instruction::InsertElement: { in ReduceExpressionGraph()
459 case Instruction::Select: { in ReduceExpressionGraph()
466 case Instruction::PHI: { in ReduceExpressionGraph()
473 llvm_unreachable("Unhandled instruction"); in ReduceExpressionGraph()
477 if (auto *ResI = dyn_cast<Instruction>(Res)) in ReduceExpressionGraph()
494 if (auto *ResI = dyn_cast<Instruction>(Res)) in ReduceExpressionGraph()
510 // We iterate backward, which means we visit the instruction before we in ReduceExpressionGraph()
514 // We still need to check that the instruction has no users before we erase in ReduceExpressionGraph()
515 // it, because {SExt, ZExt}Inst Instruction might have other users that was in ReduceExpressionGraph()
516 // not reduced, in such case, we need to keep that instruction. in ReduceExpressionGraph()
538 // Process all TruncInst in the Worklist, for each instruction: in run()