[llvm] r309959 - AMDGPU/SI: Don't fix a PHI under uniform branch in SIFixSGPRCopies only when sources and destination are all sgprs

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 13:56:42 PDT 2017


http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/6924/steps/check-llvm%20ubsan/logs/stdio


Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.
FAIL: LLVM :: MC/AMDGPU/exp.s (14527 of 21592)
******************** TEST 'LLVM :: MC/AMDGPU/exp.s' FAILED ********************
Script:
--
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/llvm-mc
-arch=amdgcn -show-encoding
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/MC/AMDGPU/exp.s
| /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/FileCheck
-check-prefix=SI
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/MC/AMDGPU/exp.s
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/llvm-mc
-arch=amdgcn -mcpu=tonga -show-encoding
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/MC/AMDGPU/exp.s
| /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/FileCheck
-check-prefix=VI
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/MC/AMDGPU/exp.s
--
Exit Code: 2

Command Output (stderr):
--
lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc:9073:33: runtime error:
index -1 out of bounds for type 'unsigned int [12]'
    #0 0x4e1272 in (anonymous
namespace)::AMDGPUAsmParser::convertToMCInst(unsigned int,
llvm::MCInst&, unsigned int,
llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand,
std::default_delete<llvm::MCParsedAsmOperand> > > const&,
llvm::SmallBitVector const&)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc:9073:33
    #1 0x4c7230 in (anonymous
namespace)::AMDGPUAsmParser::MatchInstructionImpl(llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand,
std::default_delete<llvm::MCParsedAsmOperand> > > const&,
llvm::MCInst&, unsigned long&, bool, unsigned int)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/lib/Target/AMDGPU/AMDGPUGenAsmMatcher.inc:19873:5
    #2 0x4b55b8 in (anonymous
namespace)::AMDGPUAsmParser::MatchAndEmitInstruction(llvm::SMLoc,
unsigned int&, llvm::SmallVectorImpl<std::unique_ptr<llvm::MCParsedAsmOperand,
std::default_delete<llvm::MCParsedAsmOperand> > >&, llvm::MCStreamer&,
unsigned long&, bool)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:2222:14
    #3 0x8f37ad in (anonymous
namespace)::AsmParser::parseStatement((anonymous
namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/MC/MCParser/AsmParser.cpp:2224:27
    #4 0x8eb2c8 in (anonymous namespace)::AsmParser::Run(bool, bool)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/MC/MCParser/AsmParser.cpp:883:10
    #5 0x454d70 in AssembleInput(char const*, llvm::Target const*,
llvm::SourceMgr&, llvm::MCContext&, llvm::MCStreamer&,
llvm::MCAsmInfo&, llvm::MCSubtargetInfo&, llvm::MCInstrInfo&,
llvm::MCTargetOptions&)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-mc/llvm-mc.cpp:425:21
    #6 0x453529 in main
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-mc/llvm-mc.cpp:608:11
    #7 0x7f0e4bcf382f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #8 0x42d138 in _start
(/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/bin/llvm-mc+0x42d138)

FileCheck error: '-' is empty.
FileCheck command line:
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_ubsan/./bin/FileCheck
-check-prefix=SI
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/MC/AMDGPU/exp.s



On Thu, Aug 3, 2017 at 9:37 AM, Changpeng Fang via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: chfang
> Date: Thu Aug  3 09:37:02 2017
> New Revision: 309959
>
> URL: http://llvm.org/viewvc/llvm-project?rev=309959&view=rev
> Log:
> AMDGPU/SI: Don't fix a PHI under uniform branch in SIFixSGPRCopies only
> when sources and destination are all sgprs
>
> Summary:
>   If a PHI has at lease one VGPR operand, we have to fix the PHI
> in SIFixSGPRCopies.
>
> Reviewer:
>   Matt
>
> Differential Revision:
>   http://reviews.llvm.org/D34727
>
> Modified:
>     llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
>     llvm/trunk/test/CodeGen/AMDGPU/uniform-cfg.ll
>
> Modified: llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/
> AMDGPU/SIFixSGPRCopies.cpp?rev=309959&r1=309958&r2=309959&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp (original)
> +++ llvm/trunk/lib/Target/AMDGPU/SIFixSGPRCopies.cpp Thu Aug  3 09:37:02
> 2017
> @@ -604,7 +604,8 @@ bool SIFixSGPRCopies::runOnMachineFuncti
>
>          // We don't need to fix the PHI if the common dominator of the
>          // two incoming blocks terminates with a uniform branch.
> -        if (MI.getNumExplicitOperands() == 5) {
> +        bool HasVGPROperand = phiHasVGPROperands(MI, MRI, TRI, TII);
> +        if (MI.getNumExplicitOperands() == 5 && !HasVGPROperand) {
>            MachineBasicBlock *MBB0 = MI.getOperand(2).getMBB();
>            MachineBasicBlock *MBB1 = MI.getOperand(4).getMBB();
>
> @@ -649,8 +650,7 @@ bool SIFixSGPRCopies::runOnMachineFuncti
>          // is no chance for values to be over-written.
>
>          SmallSet<unsigned, 8> Visited;
> -        if (phiHasVGPROperands(MI, MRI, TRI, TII) ||
> -            !phiHasBreakDef(MI, MRI, Visited)) {
> +        if (HasVGPROperand || !phiHasBreakDef(MI, MRI, Visited)) {
>            DEBUG(dbgs() << "Fixing PHI: " << MI);
>            TII->moveToVALU(MI);
>          }
>
> Modified: llvm/trunk/test/CodeGen/AMDGPU/uniform-cfg.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/
> CodeGen/AMDGPU/uniform-cfg.ll?rev=309959&r1=309958&r2=309959&view=diff
> ============================================================
> ==================
> --- llvm/trunk/test/CodeGen/AMDGPU/uniform-cfg.ll (original)
> +++ llvm/trunk/test/CodeGen/AMDGPU/uniform-cfg.ll Thu Aug  3 09:37:02 2017
> @@ -557,6 +557,28 @@ done:
>    ret void
>  }
>
> +; GCN-LABEL: {{^}}move_to_valu_vgpr_operand_phi:
> +; GCN: v_add_i32_e32
> +; GCN: ds_write_b32
> +define void @move_to_valu_vgpr_operand_phi(i32 addrspace(3)* %out) {
> +bb0:
> +  br label %bb1
> +
> +bb1:                                              ; preds = %bb3, %bb0
> +  %tmp0 = phi i32 [ 8, %bb0 ], [ %tmp4, %bb3 ]
> +  %tmp1 = add nsw i32 %tmp0, -1
> +  %tmp2 = getelementptr inbounds i32, i32 addrspace(3)* %out, i32 %tmp1
> +  br i1 undef, label %bb2, label %bb3
> +
> +bb2:                                              ; preds = %bb1
> +  store volatile i32 1, i32 addrspace(3)* %tmp2, align 4
> +  br label %bb3
> +
> +bb3:                                              ; preds = %bb2, %bb1
> +  %tmp4 = add nsw i32 %tmp0, 2
> +  br label %bb1
> +}
> +
>  declare i32 @llvm.amdgcn.workitem.id.x() #0
>
>  attributes #0 = { nounwind readnone }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://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/20170803/a63bcb7f/attachment.html>


More information about the llvm-commits mailing list