38 lines · plain
1; RUN: opt -mtriple=x86_64-unknown-unknown -S -codegenprepare <%s -o - | FileCheck %s2;3; Ensure return instruction splitting ignores fake uses.4;5; IR Generated with clang -O2 -S -emit-llvm -fextend-variable-liveness test.cpp6;7;// test.cpp8;extern int bar(int);9;10;int foo2(int i)11;{12; --i;13; if (i <= 0)14; return -1;15; return bar(i);16;}17 18declare i32 @_Z3bari(i32) local_unnamed_addr19 20define i32 @_Z4foo2i(i32 %i) local_unnamed_addr optdebug {21entry:22 %dec = add nsw i32 %i, -123 %cmp = icmp slt i32 %i, 224 br i1 %cmp, label %cleanup, label %if.end25 26if.end: ; preds = %entry27 %call = tail call i32 @_Z3bari(i32 %dec)28; CHECK: ret i32 %call29 br label %cleanup30 31cleanup: ; preds = %entry, %if.end32; CHECK: cleanup:33 %retval.0 = phi i32 [ %call, %if.end ], [ -1, %entry ]34 tail call void (...) @llvm.fake.use(i32 %dec)35; CHECK: ret i32 -136 ret i32 %retval.037}38