brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.2 KiB · 878260c Raw
181 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 52; RUN: llc -O3 -mtriple x86_64 -filetype asm -o - %s | FileCheck %s3;4; This test shows that ubsantrap can, in the absence of nomerge, be merged by5; the backend into a single ud1 instruction (thus making debugging difficult).6;7; The LLVM IR was generated from clang/test/CodeGen/ubsan-trap-merge.c with8; 'nomerge' manually removed from ubsantraps.9;10; ModuleID = '../clang/test/CodeGen/ubsan-trap-merge.c'11source_filename = "../clang/test/CodeGen/ubsan-trap-merge.c"12target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"13target triple = "x86_64-unknown-linux-gnu"14 15; Function Attrs: nounwind uwtable16define dso_local range(i32 -2147483523, -2147483648) i32 @f(i32 noundef %x) local_unnamed_addr #0 {17; CHECK-LABEL: f:18; CHECK:       # %bb.0: # %entry19; CHECK-NEXT:    addl $125, %edi20; CHECK-NEXT:    jo .LBB0_121; CHECK-NEXT:  # %bb.2: # %cont22; CHECK-NEXT:    movl %edi, %eax23; CHECK-NEXT:    retq24; CHECK-NEXT:  .LBB0_1: # %trap25; CHECK-NEXT:    ud1l (%eax), %eax26entry:27  %0 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %x, i32 125), !nosanitize !528  %1 = extractvalue { i32, i1 } %0, 1, !nosanitize !529  br i1 %1, label %trap, label %cont, !nosanitize !530 31trap:                                             ; preds = %entry32  tail call void @llvm.ubsantrap(i8 0) #4, !nosanitize !533  unreachable, !nosanitize !534 35cont:                                             ; preds = %entry36  %2 = extractvalue { i32, i1 } %0, 0, !nosanitize !537  ret i32 %238}39 40; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)41declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32) #142 43; Function Attrs: cold noreturn nounwind44declare void @llvm.ubsantrap(i8 immarg) #245 46; Function Attrs: nounwind uwtable47define dso_local range(i32 -2147483521, -2147483648) i32 @g(i32 noundef %x) local_unnamed_addr #0 {48; CHECK-LABEL: g:49; CHECK:       # %bb.0: # %entry50; CHECK-NEXT:    addl $127, %edi51; CHECK-NEXT:    jo .LBB1_152; CHECK-NEXT:  # %bb.2: # %cont53; CHECK-NEXT:    movl %edi, %eax54; CHECK-NEXT:    retq55; CHECK-NEXT:  .LBB1_1: # %trap56; CHECK-NEXT:    ud1l (%eax), %eax57entry:58  %0 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %x, i32 127), !nosanitize !559  %1 = extractvalue { i32, i1 } %0, 1, !nosanitize !560  br i1 %1, label %trap, label %cont, !nosanitize !561 62trap:                                             ; preds = %entry63  tail call void @llvm.ubsantrap(i8 0) #4, !nosanitize !564  unreachable, !nosanitize !565 66cont:                                             ; preds = %entry67  %2 = extractvalue { i32, i1 } %0, 0, !nosanitize !568  ret i32 %269}70 71; Function Attrs: nounwind uwtable72define dso_local range(i32 -2147483521, -2147483648) i32 @h(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {73; CHECK-LABEL: h:74; CHECK:       # %bb.0: # %entry75; CHECK-NEXT:    addl $127, %edi76; CHECK-NEXT:    jo .LBB2_377; CHECK-NEXT:  # %bb.1: # %cont78; CHECK-NEXT:    addl $129, %esi79; CHECK-NEXT:    jo .LBB2_380; CHECK-NEXT:  # %bb.2: # %cont281; CHECK-NEXT:    cmpl %esi, %edi82; CHECK-NEXT:    cmovll %edi, %esi83; CHECK-NEXT:    movl %esi, %eax84; CHECK-NEXT:    retq85; CHECK-NEXT:  .LBB2_3: # %trap86; CHECK-NEXT:    ud1l (%eax), %eax87entry:88  %0 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %x, i32 127), !nosanitize !589  %1 = extractvalue { i32, i1 } %0, 1, !nosanitize !590  br i1 %1, label %trap, label %cont, !nosanitize !591 92trap:                                             ; preds = %entry93  tail call void @llvm.ubsantrap(i8 0) #4, !nosanitize !594  unreachable, !nosanitize !595 96cont:                                             ; preds = %entry97  %2 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %y, i32 129), !nosanitize !598  %3 = extractvalue { i32, i1 } %2, 1, !nosanitize !599  br i1 %3, label %trap1, label %cont2, !nosanitize !5100 101trap1:                                            ; preds = %cont102  tail call void @llvm.ubsantrap(i8 0) #4, !nosanitize !5103  unreachable, !nosanitize !5104 105cont2:                                            ; preds = %cont106  %4 = extractvalue { i32, i1 } %2, 0, !nosanitize !5107  %5 = extractvalue { i32, i1 } %0, 0, !nosanitize !5108  %cond = tail call i32 @llvm.smin.i32(i32 %5, i32 %4)109  ret i32 %cond110}111 112; Function Attrs: nounwind uwtable113define dso_local noundef i32 @m(i32 noundef %x, i32 noundef %y) local_unnamed_addr #0 {114; CHECK-LABEL: m:115; CHECK:       # %bb.0: # %entry116; CHECK-NEXT:    addl $125, %edi117; CHECK-NEXT:    jo .LBB3_4118; CHECK-NEXT:  # %bb.1: # %f.exit119; CHECK-NEXT:    addl $127, %esi120; CHECK-NEXT:    jo .LBB3_4121; CHECK-NEXT:  # %bb.2: # %g.exit122; CHECK-NEXT:    addl %esi, %edi123; CHECK-NEXT:    jo .LBB3_4124; CHECK-NEXT:  # %bb.3: # %cont125; CHECK-NEXT:    movl %edi, %eax126; CHECK-NEXT:    retq127; CHECK-NEXT:  .LBB3_4: # %trap.i128; CHECK-NEXT:    ud1l (%eax), %eax129entry:130  %0 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %x, i32 125), !nosanitize !5131  %1 = extractvalue { i32, i1 } %0, 1, !nosanitize !5132  br i1 %1, label %trap.i, label %f.exit, !nosanitize !5133 134trap.i:                                           ; preds = %entry135  tail call void @llvm.ubsantrap(i8 0) #4, !nosanitize !5136  unreachable, !nosanitize !5137 138f.exit:                                           ; preds = %entry139  %2 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %y, i32 127), !nosanitize !5140  %3 = extractvalue { i32, i1 } %2, 1, !nosanitize !5141  br i1 %3, label %trap.i2, label %g.exit, !nosanitize !5142 143trap.i2:                                          ; preds = %f.exit144  tail call void @llvm.ubsantrap(i8 0) #4, !nosanitize !5145  unreachable, !nosanitize !5146 147g.exit:                                           ; preds = %f.exit148  %4 = extractvalue { i32, i1 } %0, 0, !nosanitize !5149  %5 = extractvalue { i32, i1 } %2, 0, !nosanitize !5150  %6 = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %4, i32 %5), !nosanitize !5151  %7 = extractvalue { i32, i1 } %6, 1, !nosanitize !5152  br i1 %7, label %trap, label %cont, !nosanitize !5153 154trap:                                             ; preds = %g.exit155  tail call void @llvm.ubsantrap(i8 0) #4, !nosanitize !5156  unreachable, !nosanitize !5157 158cont:                                             ; preds = %g.exit159  %8 = extractvalue { i32, i1 } %6, 0, !nosanitize !5160  ret i32 %8161}162 163; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)164declare i32 @llvm.smin.i32(i32, i32) #3165 166attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }167attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }168attributes #2 = { cold noreturn nounwind }169attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }170attributes #4 = { noreturn nounwind }171 172!llvm.module.flags = !{!0, !1, !2, !3}173!llvm.ident = !{!4}174 175!0 = !{i32 1, !"wchar_size", i32 4}176!1 = !{i32 8, !"PIC Level", i32 2}177!2 = !{i32 7, !"PIE Level", i32 2}178!3 = !{i32 7, !"uwtable", i32 2}179!4 = !{!"clang version 20.0.0git (https://github.com/llvm/llvm-project.git fe3c23b439b9a2d00442d9bc6a4ca86f73066a3d)"}180!5 = !{}181