[PATCH] D155461: [InstCombine] Keep !unpredictable when combining select+add

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 08:50:01 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:540
       Value *NewSel = Builder.CreateSelect(SI.getCondition(), Swapped ? C : OOp,
-                                           Swapped ? OOp : C);
+                                           Swapped ? OOp : C, "", &SI);
       if (isa<FPMathOperator>(&SI))
----------------
chfast wrote:
> I believe there are more case in the file where metadata copy is missed. I will try to identify them and create more tests cases. Can be in this review on later, depending on reviewers' suggestion.
Are there any other binops you want to preserve this flag for?


================
Comment at: llvm/test/Transforms/InstCombine/unpredictable-select.ll:1
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
----------------
chfast wrote:
> I created this test file. Is this good location?
Its fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155461



More information about the llvm-commits mailing list