@@ -13,7 +13,6 @@ SPDX-License-Identifier: MIT
13
13
#include " Compiler/CodeGenPublic.h"
14
14
#include " common/LLVMWarningsPush.hpp"
15
15
#include " llvmWrapper/IR/DerivedTypes.h"
16
- #include < llvm/Support/Alignment.h>
17
16
#include < llvmWrapper/IR/Instructions.h>
18
17
#include " llvmWrapper/IR/Function.h"
19
18
#include < llvm/IR/Module.h>
@@ -217,7 +216,7 @@ inline StructType* PromotedStructValueType(const Module& M, const Argument* arg)
217
216
}
218
217
219
218
// BE does not handle struct load/store, so instead store each element of the struct value to the GEP of the struct pointer
220
- inline void StoreToStruct (IRBuilder<>& builder, Value* strVal, Value* strPtr)
219
+ inline void StoreToStruct (IGCLLVM:: IRBuilder<>& builder, Value* strVal, Value* strPtr)
221
220
{
222
221
IGC_ASSERT (strPtr->getType ()->isPointerTy ());
223
222
IGC_ASSERT (strVal->getType ()->isStructTy ());
@@ -233,7 +232,7 @@ inline void StoreToStruct(IRBuilder<>& builder, Value* strVal, Value* strPtr)
233
232
}
234
233
235
234
// BE does not handle struct load/store, so instead load each element from the GEP struct pointer and insert it into the struct value
236
- inline Value* LoadFromStruct (IRBuilder<>& builder, Value* strPtr, Type* ty)
235
+ inline Value* LoadFromStruct (IGCLLVM:: IRBuilder<>& builder, Value* strPtr, Type* ty)
237
236
{
238
237
IGC_ASSERT (strPtr->getType ()->isPointerTy ());
239
238
IGC_ASSERT (ty->isStructTy ());
@@ -395,7 +394,7 @@ void LegalizeFunctionSignatures::FixFunctionBody(Module& M)
395
394
396
395
// Fix the usages of arguments that have changed
397
396
BasicBlock* EntryBB = BasicBlock::Create (M.getContext (), " " , pNewFunc);
398
- IRBuilder<> builder (EntryBB);
397
+ IGCLLVM:: IRBuilder<> builder (EntryBB);
399
398
for (; OldArgIt != pFunc->arg_end (); ++OldArgIt)
400
399
{
401
400
if (OldArgIt == pFunc->arg_begin () && retTypeOption == ReturnOpt::RETURN_STRUCT)
@@ -464,13 +463,12 @@ void LegalizeFunctionSignatures::FixFunctionBody(Module& M)
464
463
const auto ptrSize = DL.getPointerSize ();
465
464
for (auto RetInst : Returns)
466
465
{
467
- IRBuilder<> builder (RetInst);
466
+ IGCLLVM:: IRBuilder<> builder (RetInst);
468
467
Type* retTy = RetInst->getReturnValue ()->getType ();
469
468
Value* returnedValPtr = builder.CreateAlloca (retTy);
470
469
builder.CreateStore (RetInst->getReturnValue (), returnedValPtr);
471
470
auto size = DL.getTypeAllocSize (retTy);
472
- auto Align = MaybeAlign (ptrSize);
473
- builder.CreateMemCpy (&*pNewFunc->arg_begin (), Align, returnedValPtr, Align, size);
471
+ builder.CreateMemCpy (&*pNewFunc->arg_begin (), returnedValPtr, size, ptrSize);
474
472
builder.CreateRetVoid ();
475
473
RetInst->eraseFromParent ();
476
474
}
@@ -480,7 +478,7 @@ void LegalizeFunctionSignatures::FixFunctionBody(Module& M)
480
478
// For "sret" returns, we load from the temp alloca created earlier and return the loaded value instead
481
479
for (auto RetInst : Returns)
482
480
{
483
- IRBuilder<> builder (RetInst);
481
+ IGCLLVM:: IRBuilder<> builder (RetInst);
484
482
Value* retVal = LoadFromStruct (builder, tempAllocaForSRetPointer, tempAllocaForSRetPointerTy);
485
483
builder.CreateRet (retVal);
486
484
RetInst->eraseFromParent ();
@@ -491,7 +489,7 @@ void LegalizeFunctionSignatures::FixFunctionBody(Module& M)
491
489
// Extend illegal int returns to legal type
492
490
for (auto RetInst : Returns)
493
491
{
494
- IRBuilder<> builder (RetInst);
492
+ IGCLLVM:: IRBuilder<> builder (RetInst);
495
493
Value* retVal = RetInst->getReturnValue ();
496
494
Type* retTy = retVal->getType ();
497
495
retVal = builder.CreateZExt (retVal, LegalizedIntVectorType (M, retTy));
@@ -530,7 +528,7 @@ void LegalizeFunctionSignatures::FixFunctionUsers(Module& M)
530
528
else if (Instruction* inst = dyn_cast<Instruction>(ui))
531
529
{
532
530
// Any other uses can be replaced with a pointer cast
533
- IRBuilder<> builder (inst);
531
+ IGCLLVM:: IRBuilder<> builder (inst);
534
532
Value* pCast = builder.CreatePointerCast (pNewFunc, pFunc->getType ());
535
533
inst->replaceUsesOfWith (pFunc, pCast);
536
534
}
@@ -586,7 +584,7 @@ void LegalizeFunctionSignatures::FixCallInstruction(Module& M, CallInst* callIns
586
584
else if (!isLegalSignatureType (M, callInst->getType (), isStackCall))
587
585
{
588
586
// Create an alloca for the return type
589
- IRBuilder<> builder (callInst);
587
+ IGCLLVM:: IRBuilder<> builder (callInst);
590
588
returnPtr = builder.CreateAlloca (callInst->getType ());
591
589
callArgs.push_back (returnPtr);
592
590
// Add "noalias" and "sret" to return value operand at callsite
@@ -608,7 +606,7 @@ void LegalizeFunctionSignatures::FixCallInstruction(Module& M, CallInst* callIns
608
606
if (!isLegalIntVectorType (M, arg->getType ()))
609
607
{
610
608
// extend the illegal int to a legal type
611
- IRBuilder<> builder (callInst);
609
+ IGCLLVM:: IRBuilder<> builder (callInst);
612
610
Value* extend = builder.CreateZExt (callInst->getOperand (opNum), LegalizedIntVectorType (M, arg->getType ()));
613
611
callArgs.push_back (extend );
614
612
ArgAttrVec.push_back (AttributeSet ());
@@ -618,7 +616,7 @@ void LegalizeFunctionSignatures::FixCallInstruction(Module& M, CallInst* callIns
618
616
isPromotableStructType (M, callInst->getParamByValType (opNum), isStackCall))
619
617
{
620
618
// Map the new operand to the loaded value of the struct pointer
621
- IRBuilder<> builder (callInst);
619
+ IGCLLVM:: IRBuilder<> builder (callInst);
622
620
Value* newOp = LoadFromStruct (builder, callInst->getOperand (opNum), callInst->getParamByValType (opNum));
623
621
callArgs.push_back (newOp);
624
622
ArgAttrVec.push_back (AttributeSet ());
@@ -627,7 +625,7 @@ void LegalizeFunctionSignatures::FixCallInstruction(Module& M, CallInst* callIns
627
625
else if (!isLegalSignatureType (M, arg->getType (), isStackCall))
628
626
{
629
627
// Create and store operand as an alloca, then pass as argument
630
- IRBuilder<> builder (callInst);
628
+ IGCLLVM:: IRBuilder<> builder (callInst);
631
629
Value* allocaV = builder.CreateAlloca (arg->getType ());
632
630
builder.CreateStore (callInst->getOperand (opNum), allocaV);
633
631
callArgs.push_back (allocaV);
@@ -646,7 +644,7 @@ void LegalizeFunctionSignatures::FixCallInstruction(Module& M, CallInst* callIns
646
644
647
645
if (retTypeOption != ReturnOpt::RETURN_DEFAULT || fixArgType)
648
646
{
649
- IRBuilder<> builder (callInst);
647
+ IGCLLVM:: IRBuilder<> builder (callInst);
650
648
Value* newCalledValue = nullptr ;
651
649
FunctionType* newFnTy = nullptr ;
652
650
if (!calledFunc)
0 commit comments