brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · db40bba Raw
83 lines · plain
1; RUN: opt -loop-reduce -S < %s | FileCheck %s2;3; LTO of clang, which mistakenly uses no TargetLoweringInfo, causes a4; miscompile. ReuseOrCreateCast replace ptrtoint operand with undef.5; Reproducing the miscompile requires no triple, hence no "TTI".6; rdar://130073817 8target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"9 10; Verify that nothing uses the "dead" ptrtoint from "undef".11; CHECK-LABEL: @VerifyDiagnosticConsumerTest(12; CHECK: bb:13; "dead" ptrpoint not emitted (or dead code eliminated) with14; current LSR cost model.15; CHECK-NOT: = ptrtoint ptr undef to i6416; CHECK: .lr.ph17; CHECK: ret void18define void @VerifyDiagnosticConsumerTest(i1 %arg) unnamed_addr nounwind uwtable align 2 {19bb:20  %tmp3 = call ptr @getCharData() nounwind21  %tmp4 = call ptr @getCharData() nounwind22  %tmp5 = ptrtoint ptr %tmp4 to i6423  %tmp6 = ptrtoint ptr %tmp3 to i6424  %tmp7 = sub i64 %tmp5, %tmp625  br i1 false, label %bb87, label %.preheader26 27.preheader:                                       ; preds = %bb10, %bb28  br i1 false, label %_ZNK4llvm9StringRef4findEcm.exit42.thread, label %bb1029 30bb10:                                             ; preds = %.preheader31  br i1 true, label %_ZNK4llvm9StringRef4findEcm.exit42, label %.preheader32 33_ZNK4llvm9StringRef4findEcm.exit42:               ; preds = %bb1034  br i1 false, label %_ZNK4llvm9StringRef4findEcm.exit42.thread, label %.lr.ph35 36_ZNK4llvm9StringRef4findEcm.exit42.thread:        ; preds = %_ZNK4llvm9StringRef4findEcm.exit42, %.preheader37  unreachable38 39.lr.ph:                                           ; preds = %_ZNK4llvm9StringRef4findEcm.exit4240  br label %bb3641 42_ZNK4llvm9StringRef4findEcm.exit.loopexit:        ; preds = %bb6343  %tmp21 = icmp eq i64 %i.0.i, -144  br i1 %tmp21, label %_ZNK4llvm9StringRef4findEcm.exit._crit_edge, label %bb3645 46_ZNK4llvm9StringRef4findEcm.exit._crit_edge:      ; preds = %bb61, %_ZNK4llvm9StringRef4findEcm.exit.loopexit47  unreachable48 49bb36:                                             ; preds = %_ZNK4llvm9StringRef4findEcm.exit.loopexit, %.lr.ph50  %loc.063 = phi i64 [ undef, %.lr.ph ], [ %i.0.i, %_ZNK4llvm9StringRef4findEcm.exit.loopexit ]51  switch i8 10, label %bb57 [52    i8 10, label %bb4853    i8 13, label %bb4854  ]55 56bb48:                                             ; preds = %bb36, %bb3657  br label %bb5858 59bb57:                                             ; preds = %bb3660  br label %bb5861 62bb58:                                             ; preds = %bb57, %bb4863  %tmp59 = icmp ugt i64 %tmp7, undef64  %tmp60 = select i1 %tmp59, i64 undef, i64 %tmp765  br label %bb6166 67bb61:                                             ; preds = %bb63, %bb5868  %i.0.i = phi i64 [ %tmp60, %bb58 ], [ %tmp67, %bb63 ]69  %tmp62 = icmp eq i64 %i.0.i, %tmp770  br i1 %tmp62, label %_ZNK4llvm9StringRef4findEcm.exit._crit_edge, label %bb6371 72bb63:                                             ; preds = %bb6173  %tmp64 = getelementptr inbounds i8, ptr %tmp3, i64 %i.0.i74  %tmp65 = load i8, ptr %tmp64, align 175  %tmp67 = add i64 %i.0.i, 176  br i1 %arg, label %_ZNK4llvm9StringRef4findEcm.exit.loopexit, label %bb6177 78bb87:                                             ; preds = %bb79  ret void80}81 82declare ptr @getCharData()83