[PATCH] D32674: [LoopIdiom] PR32811 check for safety while expanding

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 10:13:20 PDT 2017


efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM, with some minor comments.



================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:825
+  if (!isSafeToExpand(NumBytesS, *SE))
+    return false;
+
----------------
We should rearrange the checks so LIR doesn't leave around the dead expansion of BasePtr... but it's not a big deal, and it would make this patch a mess, so please fix that as a followup.


================
Comment at: test/Transforms/LoopIdiom/unsafe.ll:24
+for.body5:                                        ; preds = %for.body5, %for.cond1thread-pre-split
+  %indvars.iv = phi i64 [ undef, %for.cond1thread-pre-split ], [ %indvars.iv.next, %for.body5 ]
+  %divx = sext i32 %div to i64
----------------
Using "undef" here is kind of confusing; please use 0 instead.


https://reviews.llvm.org/D32674





More information about the llvm-commits mailing list