[PATCH] D45537: [CodeGenPrepare] Move Extension Instructions Through Logical And Shift Instructions
Quentin Colombet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 24 17:04:05 PDT 2018
qcolombet added inline comments.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:3369
+ Inst->getOpcode() == Instruction::Or) &&
+ isa<ConstantInt>(Inst->getOperand(1)))
+ return true;
----------------
Do we need to restrict this to constants?
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:3382
+ if (Inst->getOpcode() == Instruction::LShr &&
+ isa<ConstantInt>(Inst->getOperand(1)) && !IsSExt)
+ return true;
----------------
Same question as And and Or, do we need to restrict to constant?
More generally, I am not an expert on how we are dealing with poisioned value, but we probably want to call out (in a comment) that given we don't have the nuw flag, we may change a poisioned value into a regular value (eg., zext i32(shrl i8 %val, 12) => gives poison, but shrl i32 (zext i8 %val), 12 is totally fine. I believe this is okay because undef also covers valid value.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:3386
+ // and(ext(shl(opnd, cst)), cst) --> and(shl(ext(opnd), ext(cst)), cst)
+ if (Inst->getOpcode() == Instruction::Shl && Inst->hasOneUse() &&
+ isa<ConstantInt>(Inst->getOperand(1))) {
----------------
Same comment as the previous one.
https://reviews.llvm.org/D45537
More information about the llvm-commits
mailing list