Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save niw/d8714f340a2c9f4d9b866cb626d83c77 to your computer and use it in GitHub Desktop.
Save niw/d8714f340a2c9f4d9b866cb626d83c77 to your computer and use it in GitHub Desktop.
I have no idea what I am doing.
diff --git a/lib/SIL/IR/SILInstruction.cpp b/lib/SIL/IR/SILInstruction.cpp
index b1e14d28d4..50d6016d68 100644
--- a/lib/SIL/IR/SILInstruction.cpp
+++ b/lib/SIL/IR/SILInstruction.cpp
@@ -1215,6 +1215,9 @@ bool SILInstruction::isTriviallyDuplicatable() const {
// If you add more cases here, you should also update SILLoop:canDuplicate.
+ if (isa<InitExistentialAddrInst>(this))
+ return false;
+
return true;
}
diff --git a/lib/SIL/Utils/LoopInfo.cpp b/lib/SIL/Utils/LoopInfo.cpp
index 72defd29eb..fdb84516da 100644
--- a/lib/SIL/Utils/LoopInfo.cpp
+++ b/lib/SIL/Utils/LoopInfo.cpp
@@ -111,6 +111,9 @@ bool SILLoop::canDuplicate(SILInstruction *I) const {
if (isa<DynamicMethodBranchInst>(I))
return false;
+ if (isa<InitExistentialAddrInst>(I))
+ return false;
+
// Some special cases above that aren't considered isTriviallyDuplicatable
// return true early.
assert(I->isTriviallyDuplicatable() &&
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment