[LLVMdev] IRBuilder and "ad hoc" optimizations
Krzysztof Parzyszek
kparzysz at codeaurora.org
Thu Apr 23 04:57:42 PDT 2015
On 4/23/2015 3:50 AM, Paweł Bylica wrote:
> Hi LLVM,
>
> IRBuilder can fold constants (that behaviour can be controlled by Folder
> type). What do you think about optionally allow IRBuilder to eliminate
> no-op instructions like `add %a, 0` or `memcpy(%a, %b, 0)`?
>
> - Paweł
>
You mean in cases when the builder is creating an instruction that is a
no-op? The problem may be with handling cases like this:
MachineInstr *MI = BuildMI(ADD, DstReg).addReg(SrcReg).addImm(0);
if (C != 0)
MI->getOperand(2).setImm(C);
If the builder doesn't create the initial SrcReg+0, then this code will
fail.
-Krzysztof
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev
mailing list