[PATCH] D52002: Omit range checks from jump tables when lowering switches with unreachable default
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 21 02:27:39 PST 2018
hans added a comment.
Thanks! Almost there.
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:9452
+ isa<UnreachableInst>(SI->getDefaultDest()->getFirstNonPHIOrDbg());
+ bool OmitRangeCheck = UnreachableDefault && SI->getNumCases() > 0;
JumpTable JT(-1U, JTI, JumpTableMBB, nullptr);
----------------
hans wrote:
> There seems to be an extra space between "Default" and "&&". Also, why do we need the SI->getNumCases() check?
This comment was never addressed.
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:9475
+ bool UnreachableDefault =
+ isa<UnreachableInst>(SI->getDefaultDest()->getFirstNonPHIOrDbg());
+ bool OmitRangeCheck = UnreachableDefault && SI->getNumCases() > 0;
----------------
nit: The indent is deeper than what LLVM code normally uses. I think it should be
```
bool UnreachableDefault =
isa<UnreachableInst>(SI->getDefaultDest()->getFirstNonPHIOrDbg());
```
================
Comment at: test/CodeGen/AArch64/switch-unreachable-default.ll:53
+
+return_label: ; preds = %case_5, %case_4, %case_3, %case_2, %case_1, %case_0
+ ret void
----------------
nit: you could drop the "; preds" comment too.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D52002/new/
https://reviews.llvm.org/D52002
More information about the llvm-commits
mailing list