[PATCH] D33420: [LIR] Strengthen the check for recurrence variable in popcnt/CTLZ

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 12:44:39 PDT 2017


evstupac added a comment.

Thanks for catching this.
The patch looks good, just some inline comments to optimize the code.



================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1042
+static bool checkRecurrence(Value *&VarX, Instruction *&DefX,
+                            BasicBlock *LoopEntry, PHINode *&PhiX) {
+  PhiX = dyn_cast<PHINode>(VarX);
----------------
I wonder if you need PhiX as a parameter. It looks like it is unused after the call.
Also it looks like the function does not modify anything, so you don't need references.


================
Comment at: test/Transforms/LoopIdiom/pr33114.ll:1
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -loop-idiom %s | FileCheck %s
----------------
I would mention that the test checks just no assert in comments.
That way we don't need all these IR output checks. 


https://reviews.llvm.org/D33420





More information about the llvm-commits mailing list