[PATCH] D29011: [IR] Add Freeze instruction

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 03:51:29 PDT 2017

nlopes added inline comments.

Comment at: lib/AsmParser/LLParser.cpp:5953
+  if (!Op->getType()->isIntegerTy())
+    return Error(Loc,"cannot freeze non-integer type");
delcypher wrote:
> @aqjune  What's the motivation to restricting the `freeze` instruction to scalar integers?
> For vector SSA registers that contain integers that we want to "freeze" this would force doing constructing a new vector by use of `extractelement`, `freeze` on the each scalar element and then `insertelement` to construct the new register. This seems a bit cumbersome.
> I presume the reason for not allowing floating point operands is that none of the floating point instructions are supposed to produce poison? However consider the `load` instruction. That could load poisoned memory and the type could be a floating point type. There's an example of a poisoned load in the IR language reference ( https://llvm.org/docs/LangRef.html#poison-values ).
You're right that in the future it may be useful to freeze vectors of integers, at least.
This is just the first version of the patch. The intent was to fix loop unswitch, which doesn't require freezing vectors yet.  As uses expand we can relax the condition.
We definitely didn't want to freeze floats; I don't know yet if that's needed or what does it mean.


More information about the llvm-commits mailing list