Changeset View
Standalone View
llvm/include/llvm/CodeGen/MachineInstr.h
Show First 20 Lines • Show All 1,122 Lines • ▼ Show 20 Lines | bool isRegSequence() const { | ||||
return getOpcode() == TargetOpcode::REG_SEQUENCE; | return getOpcode() == TargetOpcode::REG_SEQUENCE; | ||||
} | } | ||||
bool isBundle() const { | bool isBundle() const { | ||||
return getOpcode() == TargetOpcode::BUNDLE; | return getOpcode() == TargetOpcode::BUNDLE; | ||||
} | } | ||||
bool isCopy() const { | bool isCopy() const { | ||||
return getOpcode() == TargetOpcode::COPY; | return getOpcode() == TargetOpcode::COPY || | ||||
getOpcode() == TargetOpcode::TCOPY; | |||||
nickdesaulniers: Does this save a few `getOpcode()` calls? The rest of this CL explicitly compares the opcode… | |||||
It's more than just a few. isCopy() is used pretty extensively. I want the COPY_BR (or COPY_TERM) to be exactly like a normal COPY, with the only exception that it can come after a terminator. void: It's more than just a few. `isCopy()` is used pretty extensively. I want the `COPY_BR` (or… | |||||
Not Done ReplyInline ActionsI think this is potentially hazardous. I'm worried about the peephole optimizer doing things like folding a copy into a tcopy and losing the terminator bit. Can you add some testcases with coalescable tcopy pairs for PeepholeOptimizer and the register coalescer? arsenm: I think this is potentially hazardous. I'm worried about the peephole optimizer doing things… | |||||
I'll craft some tests, though note that TCOPY should only be after a terminator, so a COPY should never be merged with it. (I'll add a verifier check to ensure that TCOPY doesn't happen before a terminator.) void: I'll craft some tests, though note that TCOPY should only be after a terminator, so a COPY… | |||||
@arsenm I'm struggling a bit to come up with tests that will exercise the peephole optimizer and register coalescer. Do you have any advice on how to do this? void: @arsenm I'm struggling a bit to come up with tests that will exercise the peephole optimizer… | |||||
Not Done ReplyInline ActionsYou shouldn't need a special verifier check, it should be caught by the normal terminator before non-terminator check. I mean something like and then maybe mix in some subregistsers? The worry is the COPY will somehow replace the TCOPY arsenm: You shouldn't need a special verifier check, it should be caught by the normal terminator… | |||||
This isn't an issue as far as I can see (at least the kind of example you're referring to). A TCOPY can become a COPY if appropriate. The only time it can't become a COPY is if it occurs after a terminator, in which case it should be caught by current verifier checks. I *don't* think a COPY should become a TCOPY though. void: This isn't an issue as far as I can see (at least the kind of example you're referring to). A… | |||||
} | } | ||||
bool isFullCopy() const { | bool isFullCopy() const { | ||||
return isCopy() && !getOperand(0).getSubReg() && !getOperand(1).getSubReg(); | return isCopy() && !getOperand(0).getSubReg() && !getOperand(1).getSubReg(); | ||||
} | } | ||||
bool isExtractSubreg() const { | bool isExtractSubreg() const { | ||||
return getOpcode() == TargetOpcode::EXTRACT_SUBREG; | return getOpcode() == TargetOpcode::EXTRACT_SUBREG; | ||||
▲ Show 20 Lines • Show All 615 Lines • Show Last 20 Lines |
Does this save a few getOpcode() calls? The rest of this CL explicitly compares the opcode against COPY_BR? I just worry if this might mess up existing callsites of isCopy when getOpcode() == TargetOpcode::COPY_BR;.