[PATCH] D40650: [InstSimplify] Fold insertelement into undef if index is out of bounds

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 08:16:30 PST 2017


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

LGTM - see inline comments for some small bits.



================
Comment at: lib/Analysis/InstructionSimplify.cpp:3810
+                                       const SimplifyQuery &Q) {
+  // Try to constant fold
+  auto *VecC = dyn_cast<Constant>(Vec);
----------------
Nit: period at end of sentence; same for comment below here.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:3816
+    return ConstantFoldInsertElementInstruction(VecC, ValC, IdxC);
+
+  // Fold into undef if index is out of bounds
----------------
Please add a 'TODO' comment about handling an undef index.


================
Comment at: test/Transforms/InstCombine/pr28725.ll:3
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+%S = type { i16, i32 }
----------------
Do we really need to specify a triple and/or datalayout?


https://reviews.llvm.org/D40650





More information about the llvm-commits mailing list