[PATCH] D110616: [Legalizer] Avoid expansion to BR_CC if illegal
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 24 09:12:31 PST 2021
craig.topper added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:3558
+ SDValue Op = Tmp2.getOperand(0);
+ if (!TLI.isOperationLegalOrCustom(ISD::BR_CC, Op.getValueType()))
+ break;
----------------
I think we need to go to the else case. We shouldn't leave this function without pushing something to the Results vector. Anything that doesn't push to the Results vector, will try libcall expansion. But there is no libcall for BRCOND so we fail that too. The debug log contains these messages
```
Trying to expand node
Cannot expand node
Trying to convert node to libcall
Could not convert node to libcall
```
I think after that the BRCOND will stick around even though it isn't "legal". After that the SETCC gets letalized to a SELECT_CC. Once we leave op legalization, the last DAG combine runs. That will call back into this function to try to legalize the still illegal BRCOND. The input is no longer a SETCC so it falls to the else case here which finally legalizes it.
We should have just gone to the else the first time. It's creating a BR_CC on i32 not on fp128 so it should be fine.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110616/new/
https://reviews.llvm.org/D110616
More information about the llvm-commits
mailing list