|
27 | 27 | #include "llvm/ADT/SmallPtrSet.h"
|
28 | 28 | #include "llvm/GenXIntrinsics/GenXMetadata.h"
|
29 | 29 | #include "llvm/IR/Constants.h"
|
30 |
| -#include "llvm/IR/InstIterator.h" |
31 | 30 | #include "llvm/IR/Instructions.h"
|
32 | 31 | #include "llvm/IR/Module.h"
|
33 | 32 | #include "llvm/IR/Verifier.h"
|
@@ -260,45 +259,6 @@ void markFunctionAsESIMD(Function *F) {
|
260 | 259 | }
|
261 | 260 | }
|
262 | 261 |
|
263 |
| -void adjustAddressSpace(Function *F, uint32_t ArgNo, uint32_t ArgAddrSpace) { |
264 |
| - Argument *Arg = F->getArg(ArgNo); |
265 |
| - for (User *ArgUse : Arg->users()) { |
266 |
| - Instruction *Instr = dyn_cast<Instruction>(ArgUse); |
267 |
| - if (!Instr) |
268 |
| - continue; |
269 |
| - const AddrSpaceCastInst *ASC = dyn_cast<AddrSpaceCastInst>(ArgUse); |
270 |
| - if (ASC) { |
271 |
| - if (ASC->getDestAddressSpace() == ArgAddrSpace) |
272 |
| - continue; |
273 |
| - } |
274 |
| - |
275 |
| - const CallInst *CI = dyn_cast<CallInst>(ArgUse); |
276 |
| - if (CI) { |
277 |
| - Function *Callee = CI->getCalledFunction(); |
278 |
| - if (!Callee || Callee->isDeclaration()) |
279 |
| - continue; |
280 |
| - |
281 |
| - for (uint32_t i = 0; i < CI->getNumOperands(); ++i) { |
282 |
| - if (CI->getOperand(i) == Arg) { |
283 |
| - adjustAddressSpace(Callee, i, ArgAddrSpace); |
284 |
| - } |
285 |
| - } |
286 |
| - } else { |
287 |
| - for (unsigned int i = 0; i < ArgUse->getNumOperands(); ++i) { |
288 |
| - if (ArgUse->getOperand(i) == Arg) { |
289 |
| - PointerType *NPT = PointerType::get(Arg->getContext(), ArgAddrSpace); |
290 |
| - |
291 |
| - auto *NewInstr = new AddrSpaceCastInst(ArgUse->getOperand(i), NPT); |
292 |
| - NewInstr->insertBefore(Instr); |
293 |
| - NewInstr->setDebugLoc(Instr->getDebugLoc()); |
294 |
| - |
295 |
| - ArgUse->setOperand(i, NewInstr); |
296 |
| - } |
297 |
| - } |
298 |
| - } |
299 |
| - } |
300 |
| -} |
301 |
| - |
302 | 262 | // Process 'invoke_simd(sub_group_obj, f, spmd_args...);' call.
|
303 | 263 | //
|
304 | 264 | // If f is a function name or a function pointer, this call is lowered into
|
@@ -359,25 +319,6 @@ bool processInvokeSimdCall(CallInst *InvokeSimd,
|
359 | 319 | SimdF->addFnAttr(INVOKE_SIMD_DIRECT_TARGET_ATTR);
|
360 | 320 | }
|
361 | 321 |
|
362 |
| - if (!SimdF->isDeclaration()) { |
363 |
| - // The real arguments for invoke_simd callee start at index 2. |
364 |
| - for (uint32_t i = 2; i < InvokeSimd->arg_size(); ++i) { |
365 |
| - const Value *Arg = InvokeSimd->getArgOperand(i); |
366 |
| - if (Arg->getType()->isPointerTy()) { |
367 |
| - uint32_t AddressSpace = Arg->getType()->getPointerAddressSpace(); |
368 |
| - if (AddressSpace == 4) { |
369 |
| - const AddrSpaceCastInst *ASC = dyn_cast<AddrSpaceCastInst>(Arg); |
370 |
| - if (!ASC) |
371 |
| - continue; |
372 |
| - |
373 |
| - AddressSpace = |
374 |
| - ASC->getOperand(0)->getType()->getPointerAddressSpace(); |
375 |
| - } |
376 |
| - adjustAddressSpace(SimdF, i - 2, AddressSpace); |
377 |
| - } |
378 |
| - } |
379 |
| - } |
380 |
| - |
381 | 322 | // The invoke_simd target is known at compile-time - optimize.
|
382 | 323 | // 1. find the call to f within the cloned helper - it is its first parameter
|
383 | 324 | constexpr unsigned SimdCallTargetArgNo = 0;
|
|
0 commit comments