[PATCH] D108734: [InstCombine] Replace icmp invariant group operands with the invariant group's operands

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 15:29:20 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:5705-5724
+static bool foldICmpInvariantGroup(ICmpInst &I) {
+  bool Changed = false;
+  while (auto *O = dyn_cast<Instruction>(I.getOperand(0))) {
+    if (O->isLaunderOrStripInvariantGroup()) {
+      I.setOperand(0, O->getOperand(0));
+      Changed = true;
+    } else {
----------------
In-place replacements aren't nice.
How about:


================
Comment at: llvm/test/Transforms/InstCombine/invariant.group.ll:2
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -instcombine -early-cse -earlycse-debug-hash -S < %s | FileCheck %s
 
----------------
I'm not sure what this is testing, but pass tests that involve more than a single pass are frowned upon.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108734



More information about the llvm-commits mailing list