[llvm-commits] [llvm] r59756 - /llvm/trunk/include/llvm/Intrinsics.td
Chris Lattner
clattner at apple.com
Fri Nov 21 15:50:20 PST 2008
On Nov 21, 2008, at 2:10 PM, Bill Wendling wrote:
> I had an idea over lunch which may or may not be good. Here it is
> though.
>
> What if we add a new LLVM instruction, called, say, "flag". It would
> be similar to the icmp instruction, but unary instead of binary. It
> would take a mnemonic operator for a flag and an arithmetic expression
> as its arguments. Here's an example:
>
> %sum = add i32 %v1, %v2
> %of = flag of i32 %sum
> br i1 %of, label %overflow, label %normal
This doesn't work. LLVM IR needs to be context sensitive. For
example, what are the flags produce by an identity bitcast or phi
node? The code above should be semantically equivalent if you insert
identity bitcasts. This is exactly the problem that some of the
vector lane proposals hit.
These would have to be equivalent for this to be feasible:
> %sum = add i32 %v1, %v2
> %of = flag of i32 %sum
> br i1 %of, label %overflow, label %normal
> %sum = add i32 %v1, %v2
%tmp = bitcast i32 %sum to i32
> %of = flag of i32 %tmp
> br i1 %of, label %overflow, label %normal
Similarly for phis, call arguments, etc.
-Chris
More information about the llvm-commits
mailing list