Go to file
Whitney Tsang 1ccba7c1a1 LLVM: Optimization Pass: Remove conflicting attribute, if any, before
adding new read attribute to an argument
Summary: Update optimization pass to prevent adding read-attribute to an
argument without removing its conflicting attribute.

A read attribute, based on the result of the attribute deduction
process, might be added to an argument. The attribute might be in
conflict with other read/write attribute currently associated with the
argument. To ensure the compatibility of attributes, conflicting
attribute, if any, must be removed before a new one is added.

The following snippet shows the current behavior of the compiler, where
the compilation process is aborted due to incompatible attributes.

$ cat x.ll
; ModuleID = 'x.bc'

%_type_of_d-ccc = type <{ i8*, i8, i8, i8, i8 }>

@d-ccc = internal global %_type_of_d-ccc <{ i8* null, i8 1, i8 13, i8 0,
i8 -127 }>, align 8

define void @foo(i32* writeonly %.aaa) {
foo_entry:
  %_param_.aaa = alloca i32*, align 8
  store i32* %.aaa, i32** %_param_.aaa, align 8
  store i8 0, i8* getelementptr inbounds (%_type_of_d-ccc,
%_type_of_d-ccc* @d-ccc, i32 0, i32 3)
  ret void
}

$ opt -O3 x.ll
Attributes 'readnone and writeonly' are incompatible!
void (i32*)* @foo
in function foo
LLVM ERROR: Broken function found, compilation aborted!
The purpose of this changeset is to fix the above error. This fix is
based on a suggestion from Johannes @jdoerfert (many thanks!!!)
Authored By: anhtuyen
Reviewer: nicholas, rnk, chandlerc, jdoerfert
Reviewed By: rnk
Subscribers: hiraditya, jdoerfert, llvm-commits, anhtuyen, LLVM
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D58694

llvm-svn: 371622
2019-09-11 14:26:22 +00:00
clang [Diagnostics] Add -Wsizeof-array-div 2019-09-11 10:59:47 +00:00
clang-tools-extra [clangd] Collect location of macro definition in the ParsedAST 2019-09-10 10:10:36 +00:00
compiler-rt [libFuzzer] Make -merge=1 to reuse coverage information from the control file. 2019-09-11 14:11:08 +00:00
debuginfo-tests Make nrvo-string test more robust. 2019-06-27 20:38:37 +00:00
libclc Revert "Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC" 2019-08-05 17:23:23 +00:00
libcxx Remove ::gets for FreeBSD 13 and later 2019-09-07 22:18:20 +00:00
libcxxabi Fix incorrect demangling of call operator of lambda with explicit 2019-09-09 23:07:25 +00:00
libunwind [runtimes] Don't depend on libpthread on Android 2019-07-22 20:41:03 +00:00
lld [ELF][test] Make tests more tolerant to exact symbol addresses 2019-09-11 06:20:14 +00:00
lldb [lldb][NFC] Remove dead code in SBAddress::GetDescription 2019-09-11 13:57:41 +00:00
llgo IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
llvm LLVM: Optimization Pass: Remove conflicting attribute, if any, before 2019-09-11 14:26:22 +00:00
openmp [OpenMP] Change initialization of __kmp_global 2019-09-04 17:47:37 +00:00
parallel-libs Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
polly [DependenceInfo] Compute WAR dependence info using ISL kills. NFC. 2019-08-29 18:55:55 +00:00
pstl [pstl] Allow customizing whether per-TU insulation is provided 2019-08-13 12:49:00 +00:00
.arcconfig Update monorepo .arcconfig with new project callsign. 2019-01-31 14:34:59 +00:00
.clang-format Add .clang-tidy and .clang-format files to the toplevel of the 2019-01-29 16:43:16 +00:00
.clang-tidy Disable tidy checks with too many hits 2019-02-01 11:20:13 +00:00
.git-blame-ignore-revs Add LLDB reformatting to .git-blame-ignore-revs 2019-09-04 09:31:55 +00:00
.gitignore Add a newline at the end of the file 2019-09-04 06:33:46 +00:00
README.md

README.md

The LLVM Compiler Infrastructure

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.