[PATCH] D112142: [InstCombine][ConstantFolding] Make ConstantFoldLoadThroughBitcast TypeSize-aware

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 21 10:04:33 PDT 2021


paulwalker-arm added a comment.

My `vscale_range` comment is not concerning the implementation but rather about ensuring the ll tests do not contain potentially undefined behaviour. You can ignore this because I've commented below with an alternative that is simpler.



================
Comment at: llvm/test/Transforms/InstCombine/vscale_load.ll:27
+  %cast_to_fixed = bitcast <vscale x 16 x i1>* %stack_var to <8 x i8>*
+  %a = load <8 x i8>, <8 x i8>* %cast_to_fixed, align 16
+  ret <8 x i8> %a
----------------
This is potentially undefined behaviour (the load can read beyond the alloca).  A better option is for both tests to replace the alloca with a pointer parameter.  That way the bounds of the storage are unknown and it becomes only about the store and load.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112142



More information about the llvm-commits mailing list