Advertisement
ErikCorry

LLVM phi with i1

Nov 23rd, 2016
3,350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
LLVM 0.38 KB | None | 0 0
  1. define i64 @foo(i64, i64, i64) {
  2.   %4 = icmp eq i64 %0, 0
  3.   br i1 %4, label %left, label %right
  4.  
  5. left:
  6.   %l = icmp eq i64 %1, 1
  7.   br label %join
  8.  
  9. right:
  10.   %r = icmp eq i64 %1, %2
  11.   br label %join
  12.  
  13. join:
  14.   %lr = phi i1 [%l, %left], [%r, %right]
  15.   %iszero = icmp eq i1 %lr, 0
  16.   br i1 %iszero, label %left2, label %right2
  17.  
  18. left2:
  19.   ret i64 %2
  20.  
  21. right2:
  22.   ret i64 %0
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement