Skip to content

Commit a74ed63

Browse files
committed
Avoid additional dyn_cast testing
1 parent 801872b commit a74ed63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16739,8 +16739,7 @@ SDValue DAGCombiner::visitBITCAST(SDNode *N) {
1673916739
// fold (conv (freeze (load x))) -> (freeze (load (conv*)x))
1674016740
// If the resultant load doesn't need a higher alignment than the original!
1674116741
auto CastLoad = [this, &VT](SDValue N0, const SDLoc &DL) {
16742-
auto *LN0 = dyn_cast<LoadSDNode>(N0);
16743-
if (!LN0 || !ISD::isNormalLoad(LN0) || !N0.hasOneUse())
16742+
if (!ISD::isNormalLoad(N0.getNode()) || !N0.hasOneUse())
1674416743
return SDValue();
1674516744

1674616745
// Do not remove the cast if the types differ in endian layout.
@@ -16753,6 +16752,7 @@ SDValue DAGCombiner::visitBITCAST(SDNode *N) {
1675316752
// memory accesses. We don't care if the original type was legal or not
1675416753
// as we assume software couldn't rely on the number of accesses of an
1675516754
// illegal type.
16755+
auto *LN0 = cast<LoadSDNode>(N0);
1675616756
if ((LegalOperations || !LN0->isSimple()) &&
1675716757
!TLI.isOperationLegal(ISD::LOAD, VT))
1675816758
return SDValue();

0 commit comments

Comments
 (0)