[all-commits] [llvm/llvm-project] 7b45c5: [MC][RISCV] Check hasEmitNops before call shouldIn...

Jinyang He via All-commits all-commits at lists.llvm.org
Mon Jan 8 23:21:52 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7b45c549670a8e8b6fe90f4382b0699dd20707d3
      https://github.com/llvm/llvm-project/commit/7b45c549670a8e8b6fe90f4382b0699dd20707d3
  Author: Jinyang He <hejinyang at loongson.cn>
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
    M llvm/lib/MC/MCExpr.cpp
    A llvm/test/MC/RISCV/align-non-executable.s

  Log Message:
  -----------
  [MC][RISCV] Check hasEmitNops before call shouldInsertExtraNopBytesForCodeAlign (#77236)

The shouldInsertExtraNopBytesForCodeAlign() need STI to check whether
relax is enabled or not. It is initialized when call setEmitNops. The
setEmitNops may not be called in a section which has instructions but is
not executable. In this case uninitialized STI will cause problems.
Thus, check hasEmitNops before call it.

Fixes:
https://github.com/llvm/llvm-project/pull/76552#issuecomment-1878952480




More information about the All-commits mailing list