[PATCH] D148275: [InstCombine] support fold select(X|Y,X|Y,X) to X|Y

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 16 01:41:25 PDT 2023


nikic added a comment.

Please add one test using vectors, and a negative test with the wrong constant in the icmp.



================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4594
+    // select(X & Y == -1, X or Y, X & Y) -> X & Y
+    if (Pred == ICmpInst::Predicate::ICMP_EQ &&
+        match(CondVal, m_ICmp(Pred, m_Specific(FalseVal), m_AllOnes())) &&
----------------
Already checked above.


================
Comment at: llvm/test/Transforms/InstSimplify/select_or_and.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=instcombine < %s | FileCheck %s
+
----------------
instsimplify


================
Comment at: llvm/test/Transforms/InstSimplify/select_or_and.ll:5
+; select(Y | X == 0, X, Y | X)
+define i32 @select_or_1(i32 %0, i32 %1) {
+; CHECK-LABEL: @select_or_1(
----------------
Please name instructions in test (run through `-passes=instnamer`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148275



More information about the llvm-commits mailing list