[llvm] [clang] [Instcombine] use zext's nneg flag for icmp folding (PR #70845)

LĂ©onard Oest O'Leary via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 11 08:27:00 PST 2023


================
@@ -0,0 +1,145 @@
+; RUN: opt < %s --O3 -S | FileCheck %s
----------------
leo-ard wrote:

How did you get the SSA form ? I wasn't able to do it on my side. Here are the commands that I did : 
```bash
> build_release/bin/clang -S -emit-llvm min_max.c -fno-discard-value-names -o min_max.ll
> build_release/bin/opt -S -passes=sroa min_max.ll > min_max2.ll
> head -n 20 min_max2.ll
; ModuleID = 'min_max.ll'
source_filename = "min_max.c"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-macosx14.0.0"

; Function Attrs: noinline nounwind optnone ssp uwtable(sync)
define signext i16 @vecreduce_smin_v2i16(i32 noundef %n, ptr noundef %v) #0 {
entry:
  %n.addr = alloca i32, align 4
  %v.addr = alloca ptr, align 8
  %p = alloca i16, align 2
  %i = alloca i32, align 4
  store i32 %n, ptr %n.addr, align 4
  store ptr %v, ptr %v.addr, align 8
  store i16 0, ptr %p, align 2
  store i32 0, ptr %i, align 4
  br label %for.cond

for.cond:                                         ; preds = %for.inc, %entry
  %0 = load i32, ptr %i, align 4
```

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


More information about the cfe-commits mailing list