[llvm] 3013a94 - CoroFrame: Fix missing bitcast for some frame merges

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 15:31:33 PST 2023


Author: Matthias Braun
Date: 2023-01-23T15:31:24-08:00
New Revision: 3013a94894d5c1de808f0da638b1f921f31a697a

URL: https://github.com/llvm/llvm-project/commit/3013a94894d5c1de808f0da638b1f921f31a697a
DIFF: https://github.com/llvm/llvm-project/commit/3013a94894d5c1de808f0da638b1f921f31a697a.diff

LOG: CoroFrame: Fix missing bitcast for some frame merges

The code to adjust types when merging fields on the coroutine frame
accidentally used `GetElementPtrInst::getResultElementType()` which does
the return the type the resulting pointer points to (so misses a pointer
type). This worked most of the time by accident because the type nearly
never matched, but failed to add a necessary bitcast for from `i8**` to
`i8*`.

Differential Revision: https://reviews.llvm.org/D142385

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 1aa3b25168657..e98c601648e04 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -1634,7 +1634,7 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
       //
       // Note: If we change the strategy dealing with alignment, we need to refine
       // this casting.
-      if (GEP->getResultElementType() != Orig->getType())
+      if (GEP->getType() != Orig->getType())
         return Builder.CreateBitCast(GEP, Orig->getType(),
                                      Orig->getName() + Twine(".cast"));
     }


        


More information about the llvm-commits mailing list