[PATCH] D57871: Fix some cases where icmp (bitcast ([su]itofp X)), Y is misfolded

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 6 23:35:13 PST 2019


lebedev.ri added inline comments.


================
Comment at: test/Transforms/InstCombine/cast-int-icmp-eq-0.ll:665-666
+;
+  %f = sitofp <3 x i16> %i to  <3 x float>
+  %b = bitcast <3 x float> %f to <6 x i16>
+  %cmp = icmp sgt <6 x i16> %b, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
----------------
I agree that this currently crashes, but are you sure this is valid in the first place?
`%f = sitofp <3 x i16> %i to  <3 x float>` implies that `sizeof(float)` == `sizeof(i16)`
`%b = bitcast <3 x float> %f to <6 x i16>` implies that `sizeof(float)` == `2*sizeof(i16)`.
How can `bitcast` do that?

https://llvm.org/docs/LangRef.html#bitcast-to-instruction
> The bit sizes of value and the destination type, ty2, must be identical.
> It is always a no-op cast because no bits change with this conversion.
> The conversion is done as if the value had been stored to memory and read back as type ty2. 


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57871





More information about the llvm-commits mailing list