[PATCH] D155284: [GlobalISel] Fix infinite loop in reassociation combine

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 16 06:18:59 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4478-4479
 
-  if (isConstantOrConstantSplatVector(*MRI.getVRegDef(OpLHSRHS), MRI)) {
+  if (isConstantOrConstantSplatVector(*MRI.getVRegDef(OpLHSRHS), MRI) &&
+      !isConstantOrConstantSplatVector(*MRI.getVRegDef(OpLHSLHS), MRI)) {
     if (isConstantOrConstantSplatVector(*OpRHSDef, MRI)) {
----------------
aemerson wrote:
> Ca you add a comment here to explain why we do the second constant check.
I tried, but I'm not super confident about the explanation for why we are doing these reassociations in the first place.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155284



More information about the llvm-commits mailing list