[all-commits] [llvm/llvm-project] c2a388: [IR] Use Min behavior for module flag "PIC Level"

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Aug 18 16:29:13 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c2a38887932e3a46aa3bee35f3f5568ac68282f4
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-08-18 (Thu, 18 Aug 2022)

  Changed paths:
    M clang/test/CodeGen/piclevels.c
    M llvm/lib/IR/AutoUpgrade.cpp
    M llvm/lib/IR/Module.cpp
    M llvm/test/Bitcode/upgrade-module-flag.ll
    A llvm/test/Bitcode/upgrade-pic-level.ll
    M llvm/test/Linker/Inputs/module-flags-pic-2-b.ll
    M llvm/test/Linker/module-flags-pic-1-a.ll
    M llvm/test/Linker/module-flags-pic-2-a.ll
    M llvm/test/Transforms/Attributor/value-simplify-dbg.ll
    M llvm/test/Transforms/Attributor/value-simplify-local-remote.ll
    M llvm/test/Transforms/OpenMP/spmdization.ll
    M llvm/test/Transforms/OpenMP/spmdization_assumes.ll
    M llvm/test/Transforms/OpenMP/spmdization_guarding.ll
    M llvm/test/Transforms/OpenMP/spmdization_guarding_two_reaching_kernels.ll

  Log Message:
  [IR] Use Min behavior for module flag "PIC Level"

Using Max for both "PIC Level" and "PIE Level" is inconsistent. PIC imposes less
restriction while PIE imposes more restriction. The result generally
picks the more restrictive behavior: Min for PIC.

This choice matches `ld -r`: a non-pic object and a pic object merge into a
result which should be treated as non-pic.

To allow linking "PIC Level" using Error/Max from old bitcode files, upgrade
Error/Max to Min.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D130531

More information about the All-commits mailing list