[PATCH] D29011: [IR] Add Freeze instruction
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 13 04:36:01 PDT 2017
delcypher 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.
Thanks for clarifying. I see the instruction is documented in https://reviews.llvm.org/D29121 so I left a minor comment there about this.
More information about the llvm-commits