[PATCH] Fix DAG fold that didn't check legal ops
Hal Finkel
hfinkel at anl.gov
Mon May 18 00:31:54 PDT 2015
Hi Escha,
In the future, please post patches like this using phabricator. Although trivial, it is much easier to see the full context of the patch using the web interface (because, when uploading a patch, you upload with full context and let the web interface reduce it dynamically). Please see: http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface
> + (!LegalOperations || TLI.isOperationLegal(ISD::AND, VT)) &&
I'd prefer that we use TLI.isOperationLegalOrCustom here; otherwise, LGTM.
-Hal
----- Original Message -----
> From: "escha" <escha at apple.com>
> To: "llvm-commits" <llvm-commits at cs.uiuc.edu>
> Sent: Sunday, May 17, 2015 9:51:43 PM
> Subject: [PATCH] Fix DAG fold that didn't check legal ops
>
>
>
> This should be straightforward: an out-of-tree target has legal
> ZERO_EXTEND for a type which is not legal for AND, which causes
> breakage.
>
>
> —escha
>
>
> Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> ===================================================================
> --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp (revision 237549)
> +++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp (working copy)
> @@ -6100,6 +6100,7 @@
> // Fold (zext (and (trunc x), cst)) -> (and x, cst),
> // if either of the casts is not free.
> if (N0.getOpcode() == ISD::AND &&
> + (!LegalOperations || TLI.isOperationLegal(ISD::AND, VT)) &&
> N0.getOperand(0).getOpcode() == ISD::TRUNCATE &&
> N0.getOperand(1).getOpcode() == ISD::Constant &&
> (!TLI.isTruncateFree(N0.getOperand(0).getOperand(0).getValueType(),
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits
mailing list