[PATCH] D37198: [InlineCost] add visitSelectInst()

Chad Rosier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 09:54:00 PDT 2017


mcrosier added inline comments.


================
Comment at: lib/Analysis/InlineCost.cpp:1190
+  // Select C, X, X => X
+  if (TrueC && FalseC && TrueC == FalseC) {
+    SimplifiedValues[&SI] = TrueC;
----------------
Not sure it matters a great deal, but this could also be written as

  if ((TrueC || FalseC) && TrueC == FalseC) {

Feel free to take it or leave it; either way is probably fine.



================
Comment at: lib/Analysis/InlineCost.cpp:1211
+    // If all operands are constants.  ConstantExpr::getSelect() can handle
+    // rest cases such as select vectors.
+    if (TrueC && FalseC) {
----------------
can handle the rest of the cases, such as select vectors.


================
Comment at: lib/Analysis/InlineCost.cpp:1220
+
+  // Second check if SI can be mapped toi a ConstantOffsetPtr and then a
+  // SROAArg.
----------------
toi -> to


Repository:
  rL LLVM

https://reviews.llvm.org/D37198





More information about the llvm-commits mailing list