[llvm] [AMDGPU] Fix canonicalization of truncated values. (PR #83054)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 03:17:25 PST 2024
================
@@ -194,7 +194,26 @@ class HasOneUseTernaryOp<SDPatternOperator op> : PatFrag<
}];
}
-class is_canonicalized<SDPatternOperator op> : PatFrag<
+class is_canonicalized_1<SDPatternOperator op> : PatFrag<
+ (ops node:$src0),
+ (op $src0),
+ [{
+ const SITargetLowering &Lowering =
+ *static_cast<const SITargetLowering *>(getTargetLowering());
+
+ return Lowering.isCanonicalized(*CurDAG, N->getOperand(0));
+ }]> {
+
+ // TODO: Improve the Legalizer for g_build_vector in Global Isel to match this class
+ let GISelPredicateCode = [{
+ const SITargetLowering *TLI = static_cast<const SITargetLowering *>(
+ MF.getSubtarget().getTargetLowering());
+
+ return TLI->isCanonicalized(MI.getOperand(1).getReg(), const_cast<MachineFunction&>(MF));
----------------
arsenm wrote:
why does isCanonicalized have a non-const MF parameter?
https://github.com/llvm/llvm-project/pull/83054
More information about the llvm-commits
mailing list