brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 064d3f2 Raw
51 lines · plain
1; RUN: opt < %s -passes='require<profile-summary>,function(codegenprepare)' -S -mtriple=x86_64 | FileCheck %s --implicit-check-not="llvm.fake.use"2;3; When performing return duplication to enable4; tail call optimization we clone fake uses that exist in the to-be-eliminated5; return block into the predecessor blocks. When doing this with fake uses6; of PHI-nodes, they cannot be easily copied, but require the correct operand.7; We are currently not able to do this correctly, so we suppress the cloning8; of such fake uses at the moment.9;10; There should be no fake use of a call result in any of the resulting return11; blocks.12 13; Fake uses of `this` should be duplicated into both return blocks.14; CHECK: if.then:15; CHECK: @llvm.fake.use({{.*}}this16; CHECK: if.else:17; CHECK: @llvm.fake.use({{.*}}this18 19; CHECK: declare void @llvm.fake.use20 21source_filename = "test.ll"22 23%class.a = type { i8 }24 25declare i32 @foo(ptr nonnull dereferenceable(1)) local_unnamed_addr26declare i32 @bar(ptr nonnull dereferenceable(1)) local_unnamed_addr27 28define hidden void @func(ptr nonnull dereferenceable(1) %this) local_unnamed_addr align 2 optdebug {29entry:30  %b = getelementptr inbounds %class.a, ptr %this, i64 0, i32 031  %0 = load i8, i8* %b, align 132  %tobool.not = icmp eq i8 %0, 033  br i1 %tobool.not, label %if.else, label %if.then34 35if.then:                                          ; preds = %entry36  %call = tail call i32 @foo(ptr nonnull dereferenceable(1) %this)37  %call2 = tail call i32 @bar(ptr nonnull dereferenceable(1) %this)38  br label %if.end39 40if.else:                                          ; preds = %entry41  %call4 = tail call i32 @bar(ptr nonnull dereferenceable(1) %this)42  %call5 = tail call i32 @foo(ptr nonnull dereferenceable(1) %this)43  br label %if.end44 45if.end:                                           ; preds = %if.else, %if.then46  %call4.sink = phi i32 [ %call4, %if.else ], [ %call, %if.then ]47  notail call void (...) @llvm.fake.use(i32 %call4.sink)48  notail call void (...) @llvm.fake.use(ptr nonnull %this)49  ret void50}51