[llvm-commits] [llvm] r76810 - in /llvm/trunk: docs/LangRef.html lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/VMCore/AsmWriter.cpp test/Assembler/flags-reversed.ll test/Assembler/flags-signed.ll test/Assembler/

Eli Friedman eli.friedman at gmail.com
Wed Jul 22 22:43:50 PDT 2009


On Wed, Jul 22, 2009 at 10:09 PM, Nick Lewycky<nicholas at mxc.ca> wrote:
> I just want to be certain that I grok the intended semantics here. Given:
>
>   %A = add nuw i8 %x, %y
>   %B = add nsw i8 %x, %y
>   %C1 = icmp uge i8 %A, %x
>   %C2 = icmp uge i8 %A, %y
>   %D1 = icmp sge i8 %A, %x
>   %D2 = icmp sge i8 %A, %y
>
> may we state that %C1, %C2, %D1 and %D2 are all true?

%C1 and %C2 can be legally optimized to true (but note that that isn't
precisely the same thing as saying they are actually true).  It's
impossible to say anything about %D1 and %D2 as written; %B is dead
and doesn't have an "undefined behavior" effect that could somehow
influence the subsequent comparisons.  This allows optimizations like
if-conversion, unconditional LICM, etc., just like our existing
treatment of undefined shifts.  Given the following in addition:

%D3 = icmp sge i8 %B, %x

%D3 can be optimized to "icmp sge i8 %y, 0".

-Eli




More information about the llvm-commits mailing list