[llvm] [Float2Int] Resolve FIXME: Pick the smallest legal type that fits (PR #79158)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 11:58:24 PDT 2024


AtariDreams wrote:

Using built clang at HEAD:

; Function Attrs: mustprogress nofree norecurse nounwind ssp memory(inaccessiblemem: readwrite) uwtable(sync)
define noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1)
  store volatile i32 1, ptr %1, align 4, !tbaa !5
  %2 = load volatile i32, ptr %1, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  %4 = select i1 %3, i32 255, i32 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1)
  ret i32 %4
}

This happens when I run emit-llvm at -O3
it is generating 255 as expected. Now, I need to figure out why this is translating into 127



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


More information about the llvm-commits mailing list