[PATCH] D119654: [SDAG] enable binop identity constant folds for add/sub

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 17 13:08:19 PST 2022


xbolva00 added inline comments.


================
Comment at: llvm/test/CodeGen/X86/avx512vnni-intrinsics-upgrade.ll:66
+; X86-NEXT:    vpaddd %zmm0, %zmm3, %zmm3 {%k1} # encoding: [0x62,0xf1,0x65,0x49,0xfe,0xd8]
+; X86-NEXT:    vmovdqa64 %zmm3, %zmm0 # encoding: [0x62,0xf1,0xfd,0x48,0x6f,0xc3]
 ; X86-NEXT:    retl # encoding: [0xc3]
----------------
LuoYuanke wrote:
> This can be improved in RA by evict the previous assigned physical register (zmm0) with below patch, but there is some risk on performance regression, because we change the general RA evicting rule. If anyone concern about this additional vmovdqa64, I can separate sub from add in the patch and we may submit sub    patch first.
> 
> ```
> diff --git a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp
> index 718e12e5d602..863394fffeb6 100644
> --- a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp
> +++ b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp
> @@ -168,6 +168,7 @@ bool DefaultEvictionAdvisor::canEvictHintInterference(
>      const SmallVirtRegSet &FixedRegisters) const {
>    EvictionCost MaxCost;
>    MaxCost.setBrokenHints(1);
> +  MaxCost.MaxWeight = VirtReg.weight();
>    return canEvictInterferenceBasedOnCost(VirtReg, PhysReg, true, MaxCost,
>                                           FixedRegisters);
>  }
> ```
In any case, Consider posting this patch for RA on Phabricator.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119654/new/

https://reviews.llvm.org/D119654



More information about the llvm-commits mailing list