[llvm] [InstCombine] Only fold extract element to trunc if vector `hasOneUse` (PR #115627)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 13:46:53 PST 2024


================
@@ -722,20 +722,14 @@ define i8 @bitcast_scalar_index_variable(i32 %x, i64 %y) {
   ret i8 %r
 }
 
-; extra use is ok if we don't need a shift
+; extra use is not ok, even if we don't need a shift
----------------
nikic wrote:

This case could be okay as we're just replacing extractelement with trunc here, without also inserting a bitcast. But tentatively I'd agree that if we're going to cast to a vector anyway, it makes sense to stay in vector representation.

https://github.com/llvm/llvm-project/pull/115627


More information about the llvm-commits mailing list