[llvm] [SelectionDAG] Treat CopyFromReg as freezing the value (PR #85932)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 29 02:23:49 PDT 2024
================
@@ -15452,6 +15452,26 @@ SDValue DAGCombiner::visitFREEZE(SDNode *N) {
N0.getOpcode() == ISD::BUILD_PAIR ||
N0.getOpcode() == ISD::CONCAT_VECTORS;
+ // Avoid turning a BUILD_VECTOR that can be recognized as "all zeros", "all
+ // ones" or "constant" into something that depends on FrozenUndef. We can
+ // instead pick undef values to keep those properties, while at the same time
+ // folding away the freeze.
+ // If we implement a more general solution for folding away freeze(undef) in
+ // the future, then this special handling can be removed.
+ if (N0.getOpcode() == ISD::BUILD_VECTOR) {
+ SDLoc DL(N0);
+ MVT VT = N0.getSimpleValueType();
----------------
RKSimon wrote:
I'm guessing these need to be `EVT VT = N0.getValueType();`
https://github.com/llvm/llvm-project/pull/85932
More information about the llvm-commits
mailing list