[PATCH] D68131: Switch lowering: omit range check for bit tests when default is unreachable (PR43129)
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 06:50:29 PDT 2019
spatel added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2630-2633
SDValue RangeCmp = DAG.getSetCC(
dl, TLI.getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(),
Sub.getValueType()),
Sub, DAG.getConstant(B.Range, dl, VT), ISD::SETUGT);
----------------
Can we sink RangeCmp into the !OmitRangeCheck block below? As written, we are potentially creating a node with no uses?
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:2666-2667
+ // Branch or fall through to MBB without any range check.
+ if (MBB != NextBlock(SwitchBB))
+ Root = DAG.getNode(ISD::BR, dl, MVT::Other, Root, DAG.getBasicBlock(MBB));
+ } else {
----------------
Is the optional branch to MBB identical on both sides of this if/else? If so, sink it after the if/else (and that simplifies the if/else to just !OmitRangeCheck)?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68131/new/
https://reviews.llvm.org/D68131
More information about the llvm-commits
mailing list