[llvm] 1398460 - [RISCVGatherScatterLowering] Minor code cleanup [NFC]
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri May 12 23:32:51 PDT 2023
Sorry, leaks indeed from [RISCV][llvm-mca] Add mca tests for riscv lmul
instruments
<https://github.com/llvm/llvm-project/commit/1e317c3f819c7b42f8b45383438004193d3344d4>
On Fri, 12 May 2023 at 16:21, Craig Topper <craig.topper at gmail.com> wrote:
> The llvm-mca test failures were caused by [RISCV][llvm-mca] Add mca tests
> for riscv lmul instruments
> <https://github.com/llvm/llvm-project/commit/1e317c3f819c7b42f8b45383438004193d3344d4> and
> the author already reverted it.
>
> ~Craig
>
>
> On Fri, May 12, 2023 at 2:14 PM Vitaly Buka via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Probably this leak is from the patch.
>> https://lab.llvm.org/buildbot/#/builders/5/builds/33651
>>
>> On Fri, 12 May 2023 at 10:34, Philip Reames via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>>
>>> Author: Philip Reames
>>> Date: 2023-05-12T10:33:29-07:00
>>> New Revision: 13984608992246e42e66c019f09764650d60af63
>>>
>>> URL:
>>> https://github.com/llvm/llvm-project/commit/13984608992246e42e66c019f09764650d60af63
>>> DIFF:
>>> https://github.com/llvm/llvm-project/commit/13984608992246e42e66c019f09764650d60af63.diff
>>>
>>> LOG: [RISCVGatherScatterLowering] Minor code cleanup [NFC]
>>>
>>> Use a switch to avoid repeat tests on the opcode, and factor out some
>>> common code out of another switch. (Not all branches had both common bits,
>>> but the one which didn't left the values unchanged and their starting value
>>> is the respective operand - so storing it back is a nop.)
>>>
>>> Added:
>>>
>>>
>>> Modified:
>>> llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
>>>
>>> Removed:
>>>
>>>
>>>
>>>
>>> ################################################################################
>>> diff --git a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
>>> b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
>>> index e844e1b11271..0174aa547a1b 100644
>>> --- a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
>>> +++ b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
>>> @@ -225,20 +225,24 @@ bool
>>> RISCVGatherScatterLowering::matchStridedRecurrence(Value *Index, Loop *L,
>>> if (!BO)
>>> return false;
>>>
>>> - if (BO->getOpcode() != Instruction::Add &&
>>> - BO->getOpcode() != Instruction::Or &&
>>> - BO->getOpcode() != Instruction::Mul &&
>>> - BO->getOpcode() != Instruction::Shl)
>>> - return false;
>>> -
>>> - // Only support shift by constant.
>>> - if (BO->getOpcode() == Instruction::Shl &&
>>> !isa<Constant>(BO->getOperand(1)))
>>> - return false;
>>> -
>>> - // We need to be able to treat Or as Add.
>>> - if (BO->getOpcode() == Instruction::Or &&
>>> - !haveNoCommonBitsSet(BO->getOperand(0), BO->getOperand(1), *DL))
>>> + switch (BO->getOpcode()) {
>>> + default:
>>> return false;
>>> + case Instruction::Or:
>>> + // We need to be able to treat Or as Add.
>>> + if (!haveNoCommonBitsSet(BO->getOperand(0), BO->getOperand(1), *DL))
>>> + return false;
>>> + break;
>>> + case Instruction::Add:
>>> + break;
>>> + case Instruction::Shl:
>>> + // Only support shift by constant.
>>> + if (!isa<Constant>(BO->getOperand(1)))
>>> + return false;
>>> + break;
>>> + case Instruction::Mul:
>>> + break;
>>> + }
>>>
>>> // We should have one operand in the loop and one splat.
>>> Value *OtherOp;
>>> @@ -291,7 +295,6 @@ bool
>>> RISCVGatherScatterLowering::matchStridedRecurrence(Value *Index, Loop *L,
>>> Start = SplatOp;
>>> else
>>> Start = Builder.CreateAdd(Start, SplatOp, "start");
>>> - BasePtr->setIncomingValue(StartBlock, Start);
>>> break;
>>> }
>>> case Instruction::Mul: {
>>> @@ -306,8 +309,6 @@ bool
>>> RISCVGatherScatterLowering::matchStridedRecurrence(Value *Index, Loop *L,
>>> Stride = SplatOp;
>>> else
>>> Stride = Builder.CreateMul(Stride, SplatOp, "stride");
>>> - Inc->setOperand(StepIndex, Step);
>>> - BasePtr->setIncomingValue(StartBlock, Start);
>>> break;
>>> }
>>> case Instruction::Shl: {
>>> @@ -316,12 +317,12 @@ bool
>>> RISCVGatherScatterLowering::matchStridedRecurrence(Value *Index, Loop *L,
>>> Start = Builder.CreateShl(Start, SplatOp, "start");
>>> Step = Builder.CreateShl(Step, SplatOp, "step");
>>> Stride = Builder.CreateShl(Stride, SplatOp, "stride");
>>> - Inc->setOperand(StepIndex, Step);
>>> - BasePtr->setIncomingValue(StartBlock, Start);
>>> break;
>>> }
>>> }
>>>
>>> + Inc->setOperand(StepIndex, Step);
>>> + BasePtr->setIncomingValue(StartBlock, Start);
>>> return true;
>>> }
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230512/57467272/attachment.html>
More information about the llvm-commits
mailing list