[llvm] [CGP] Permit tail call optimization on undefined return value (PR #82419)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 10:45:24 PST 2024


================
@@ -362,8 +362,30 @@ return:
   ret ptr %src
 }
 
+ at i = global i32 0, align 4
+
+define i32 @undef_tailc() nounwind {
+; CHECK-LABEL: undef_tailc:
+; CHECK:       ## %bb.0:
+; CHECK-NEXT:    cmpl $0, _i(%rip)
+; CHECK-NEXT:    jne _qux ## TAILCALL
+; CHECK-NEXT:  ## %bb.1:
+; CHECK-NEXT:    retq
+  %1 = load i32, ptr @i, align 4
+  %2 = icmp eq i32 %1, 0
+  br i1 %2, label %5, label %3
+
+3:
+  %4 = tail call i32 @qux()
+  br label %5
+
+5:
----------------
antoniofrighetto wrote:

Right, thanks for reminding this.

https://github.com/llvm/llvm-project/pull/82419


More information about the llvm-commits mailing list