[llvm] 39f780b - [OpaquePtr] Cleanup some uses of getPointerElementType() in TailRecursionElimination

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 1 14:28:14 PDT 2021


Author: Arthur Eubanks
Date: 2021-09-01T14:24:47-07:00
New Revision: 39f780b51d7cf450591b20ec9b9c395dab8836fc

URL: https://github.com/llvm/llvm-project/commit/39f780b51d7cf450591b20ec9b9c395dab8836fc
DIFF: https://github.com/llvm/llvm-project/commit/39f780b51d7cf450591b20ec9b9c395dab8836fc.diff

LOG: [OpaquePtr] Cleanup some uses of getPointerElementType() in TailRecursionElimination

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
index 846a9321f53e..e7cb87aefd65 100644
--- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -584,8 +584,8 @@ void TailRecursionEliminator::insertAccumulator(Instruction *AccRecInstr) {
 // call instruction into the newly created temporarily variable.
 void TailRecursionEliminator::copyByValueOperandIntoLocalTemp(CallInst *CI,
                                                               int OpndIdx) {
-  PointerType *ArgTy = cast<PointerType>(CI->getArgOperand(OpndIdx)->getType());
-  Type *AggTy = ArgTy->getElementType();
+  Type *AggTy = CI->getParamByValType(OpndIdx);
+  assert(AggTy);
   const DataLayout &DL = F.getParent()->getDataLayout();
 
   // Get alignment of byVal operand.
@@ -611,8 +611,8 @@ void TailRecursionEliminator::copyByValueOperandIntoLocalTemp(CallInst *CI,
 // into the corresponding function argument location.
 void TailRecursionEliminator::copyLocalTempOfByValueOperandIntoArguments(
     CallInst *CI, int OpndIdx) {
-  PointerType *ArgTy = cast<PointerType>(CI->getArgOperand(OpndIdx)->getType());
-  Type *AggTy = ArgTy->getElementType();
+  Type *AggTy = CI->getParamByValType(OpndIdx);
+  assert(AggTy);
   const DataLayout &DL = F.getParent()->getDataLayout();
 
   // Get alignment of byVal operand.


        


More information about the llvm-commits mailing list