[PATCH] D72837: [AggressiveInstCombine] Add support for select instructions

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 13:28:57 PST 2020


spatel added a comment.

Verify that the translation is correct, but I don't think this patch is safe:

  define i16 @cmp_select_sext_const(i8 %a) {
    %conv = sext i8 %a to i32
    %cmp = icmp slt i32 %conv, 32768
    %cond = select i1 %cmp, i32 32768, i32 %conv
    %conv4 = trunc i32 %cond to i16
    ret i16 %conv4
  }
  
  $ opt -aggressive-instcombine agg.ll -S
  define i16 @cmp_select_sext_const(i8 %a) {
    %conv = sext i8 %a to i16
    %cmp = icmp slt i16 %conv, -32768
    %cond = select i1 %cmp, i16 -32768, i16 %conv
    ret i16 %cond
  }

https://rise4fun.com/Alive/JCo


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

https://reviews.llvm.org/D72837





More information about the llvm-commits mailing list