[PATCH] D108084: [TypePromotion] Don't mutate the result type of SwitchInst.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 16 08:54:49 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92abb1cf90ff: [TypePromotion] Don't mutate the result type of SwitchInst. (authored by craig.topper).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108084/new/
https://reviews.llvm.org/D108084
Files:
llvm/lib/CodeGen/TypePromotion.cpp
llvm/lib/IR/Verifier.cpp
Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -2691,6 +2691,7 @@
}
void Verifier::visitSwitchInst(SwitchInst &SI) {
+ Assert(SI.getType()->isVoidTy(), "Switch must have void result type!", &SI);
// Check to make sure that all of the constants in the switch instruction
// have the same type as the switched-on value.
Type *SwitchTy = SI.getCondition()->getType();
Index: llvm/lib/CodeGen/TypePromotion.cpp
===================================================================
--- llvm/lib/CodeGen/TypePromotion.cpp
+++ llvm/lib/CodeGen/TypePromotion.cpp
@@ -539,8 +539,8 @@
I->setOperand(i, UndefValue::get(ExtTy));
}
- // Mutate the result type, unless this is an icmp.
- if (!isa<ICmpInst>(I)) {
+ // Mutate the result type, unless this is an icmp or switch.
+ if (!isa<ICmpInst>(I) && !isa<SwitchInst>(I)) {
I->mutateType(ExtTy);
Promoted.insert(I);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108084.366651.patch
Type: text/x-patch
Size: 1029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210816/1463283d/attachment.bin>
More information about the llvm-commits
mailing list