[PATCH] D130531: [IR] Use Min behavior for module flag "PIC Level"

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 25 16:48:14 PDT 2022


MaskRay created this revision.
MaskRay added reviewers: davide, tejohnson.
Herald added subscribers: StephenFan, okura, kuter, hiraditya.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130531

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130531.447519.patch
Type: text/x-patch
Size: 11220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220725/c546aee4/attachment.bin>


More information about the cfe-commits mailing list