[PATCH] D61934: [SCEV] Use wrap flags in InsertBinop

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 13:39:41 PDT 2019


nikic added inline comments.


================
Comment at: test/Transforms/LoopIdiom/basic.ll:49
 ; CHECK: %[[BaseBC:.*]] = bitcast i16* %Base to i8*
-; CHECK: %[[Sz:[0-9]+]] = shl i64 %Size, 1
+; CHECK: %[[Sz:[0-9]+]] = shl nuw i64 %Size, 1
 ; CHECK: call void @llvm.memset.p0i8.i64(i8* align 2 %[[BaseBC]], i8 0, i64 %[[Sz]], i1 false)
----------------
This nuw flag seems dubious. Or maybe the whole transform is dubious. It's not immediately clear to me why it would be illegal to have a loop that clears a whole address space using say i16s and size half the address space. In that case this memset formation will go from clearing the address space to setting zero bytes. With the additional nuw flag it will be UB instead. But I don't think it's UB to pass a large size to this function in the first place. Am I wrong about that?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61934/new/

https://reviews.llvm.org/D61934





More information about the llvm-commits mailing list