and_empty_block.carbon 1015 B

1234567891011121314151617181920212223242526
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. fn And(b: bool, c: bool) -> bool {
  7. // Note that in this case, we must generate an empty block so that the `phi`
  8. // has two distinct predecessors.
  9. return b and c;
  10. }
  11. // CHECK:STDOUT: ; ModuleID = 'and_empty_block.carbon'
  12. // CHECK:STDOUT: source_filename = "and_empty_block.carbon"
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: define i1 @And(i1 %b, i1 %c) {
  15. // CHECK:STDOUT: entry:
  16. // CHECK:STDOUT: br i1 %b, label %and.rhs, label %and.result
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: and.rhs: ; preds = %entry
  19. // CHECK:STDOUT: br label %and.result
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: and.result: ; preds = %and.rhs, %entry
  22. // CHECK:STDOUT: %0 = phi i1 [ false, %entry ], [ %c, %and.rhs ]
  23. // CHECK:STDOUT: ret i1 %0
  24. // CHECK:STDOUT: }