brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 3287d65 Raw
35 lines · plain
1; RUN: opt -passes=loop-idiom -S < %s | FileCheck %s2 3target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"4target triple = "arm64-apple-ios8.0.0"5 6; When we replace the precondition with a ctpop, we need to ensure7; that only the first branch reads the ctpop.  The store prior8; to that should continue to read from the original compare.9 10; CHECK: %tobool.5 = icmp ne i32 %num, 011; CHECK: store i1 %tobool.5, ptr %ptr12 13define internal fastcc i32 @num_bits_set(i32 %num, ptr %ptr) #1 {14entry:15  %tobool.5 = icmp ne i32 %num, 016  store i1 %tobool.5, ptr %ptr17  br i1 %tobool.5, label %for.body.lr.ph, label %for.end18 19for.body.lr.ph:                                   ; preds = %entry20  br label %for.body21 22for.body:                                         ; preds = %for.body.lr.ph, %for.body23  %count.07 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]24  %num.addr.06 = phi i32 [ %num, %for.body.lr.ph ], [ %and, %for.body ]25  %sub = add i32 %num.addr.06, -126  %and = and i32 %sub, %num.addr.0627  %inc = add nsw i32 %count.07, 128  %tobool = icmp ne i32 %and, 029  br i1 %tobool, label %for.body, label %for.end30 31for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry32  %count.0.lcssa = phi i32 [ %inc, %for.body ], [ 0, %entry ]33  ret i32 %count.0.lcssa34}35