forked from OSchip/llvm-project
[CoroSplit] Avoid self-replacement
With opaque pointers, the bitcast might be a no-op, and this can end up trying to replace a value with itself, which is illegal.
This commit is contained in:
parent
6ca2f1938f
commit
ce6ca00a92
|
@ -1015,7 +1015,8 @@ void CoroCloner::create() {
|
|||
auto *NewVFrame = Builder.CreateBitCast(
|
||||
NewFramePtr, Type::getInt8PtrTy(Builder.getContext()), "vFrame");
|
||||
Value *OldVFrame = cast<Value>(VMap[Shape.CoroBegin]);
|
||||
OldVFrame->replaceAllUsesWith(NewVFrame);
|
||||
if (OldVFrame != NewVFrame)
|
||||
OldVFrame->replaceAllUsesWith(NewVFrame);
|
||||
|
||||
switch (Shape.ABI) {
|
||||
case coro::ABI::Switch:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: opt -passes='function(coro-early),cgscc(coro-split)' -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='function(coro-early),cgscc(coro-split)' -opaque-pointers=0 -S < %s | FileCheck %s
|
||||
; RUN: opt -passes='function(coro-early),cgscc(coro-split)' -opaque-pointers=1 -S < %s | FileCheck %s
|
||||
|
||||
declare token @llvm.coro.id(i32, i8* readnone, i8* nocapture readonly, i8*)
|
||||
|
||||
|
|
Loading…
Reference in New Issue