[PATCH] D28968: LoopUnswitch - Simplify based on known not to a be constant.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 16:02:46 PST 2017


efriedma added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:242
+    /// in the loop.
+    Value *SimplifyInstructionWithNotValue(Instruction *Inst, Value *Cond,
+                                           Constant *Val);
----------------
The name "Cond" is kind of confusing... it's the condition of some switch somewhere, but that isn't particularly relevant here.  Maybe "Invariant" is a better name, since that's the important property?

Also, the name of the function isn't great... maybe rename it SimplifyInstructionWithNotEqual?


================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:1390
+  // This is an integer comparison instruction and its operands are Cond
+  // and Val. And we know Cond is not equal to Val, try to simplify it.
+  ICmpInst *CI = dyn_cast<ICmpInst>(Inst);
----------------
This comment is a bit difficult to parse.  Maybe just "icmp eq cond, val -> false"?


================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:1407
+  //
+  // Do not know how to simplify instruction
+  return nullptr;
----------------
Redundant comment.


https://reviews.llvm.org/D28968





More information about the llvm-commits mailing list