mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 13:11:39 +01:00
089dd5d55e
Summary: As a starting step, we only use one simple heuristic: if the sign bits of both a and b are zero, we can prove "add a, b" do not unsigned overflow, and thus convert it to "add nuw a, b". Updated all affected tests and added two new tests (@zero_sign_bit and @zero_sign_bit2) in AddOverflow.ll Test Plan: make check-all Reviewers: eliben, rafael, meheff, chandlerc Reviewed By: chandlerc Subscribers: chandlerc, llvm-commits Differential Revision: http://reviews.llvm.org/D4144 llvm-svn: 211084
10 lines
223 B
LLVM
10 lines
223 B
LLVM
; RUN: opt < %s -instcombine -S | grep "add nuw nsw i32"
|
|
|
|
define double @x(i32 %a, i32 %b) nounwind {
|
|
%m = lshr i32 %a, 24
|
|
%n = and i32 %m, %b
|
|
%o = sitofp i32 %n to double
|
|
%p = fadd double %o, 1.0
|
|
ret double %p
|
|
}
|