llvm-project/llvm/test
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
..
Analysis [MemorySSA] Do not create memoryaccesses for debug info intrinsics. 2019-09-10 22:35:27 +00:00
Assembler Debug Info: Support for DW_AT_export_symbols for anonymous structs 2019-08-23 17:19:21 +00:00
Bindings
Bitcode [BitcodeReader] Check if we can create a null constant for type. 2019-08-21 18:20:11 +00:00
BugPoint
CodeGen [Alignment] Use llvm::Align in MachineFunction and TargetLowering - fixes mir parsing 2019-09-11 11:16:48 +00:00
DebugInfo [Alignment] Use llvm::Align in MachineFunction and TargetLowering - fixes mir parsing 2019-09-11 11:16:48 +00:00
Demangle
Examples
ExecutionEngine [JITLink] Don't under-align zero-fill sections. 2019-08-27 15:22:23 +00:00
Feature [FPEnv] Add fptosi and fptoui constrained intrinsics. 2019-08-28 16:33:36 +00:00
FileCheck [FileCheck] Forbid using var defined on same line 2019-09-02 14:04:00 +00:00
Instrumentation [NewPM][Sancov] Make Sancov a Module Pass instead of 2 Passes 2019-09-04 20:30:29 +00:00
Integer
JitListener
LTO Reland "Change the X86 datalayout to add three address spaces 2019-09-10 23:15:38 +00:00
Linker Remove some unnecessary REQUIRES: shell lines 2019-09-10 00:06:52 +00:00
MC [RISCV] Support llvm-objdump -M no-aliases and -M numeric 2019-09-10 16:24:03 +00:00
MachineVerifier Remove unnecessary REQUIRES from a test. 2019-08-24 02:39:51 +00:00
Object [Object][TextAPI] NFC, fix tapi lit tests 2019-09-11 00:13:01 +00:00
ObjectYAML [ObjectYAML] Fix lifetime issue in dumpDebugLines 2019-08-29 02:36:48 +00:00
Other Revert "Reland "r364412 [ExpandMemCmp][MergeICmps] Move passes out of CodeGen into opt pipeline."" 2019-09-10 10:39:09 +00:00
Reduce Revert "llvm-reduce: Add pass to reduce parameters" 2019-09-11 00:44:17 +00:00
SafepointIRVerifier
Support
SymbolRewriter
TableGen GlobalISel/TableGen: Handle REG_SEQUENCE patterns 2019-09-10 17:57:33 +00:00
ThinLTO/X86 Revert "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM" 2019-09-11 09:16:17 +00:00
Transforms LLVM: Optimization Pass: Remove conflicting attribute, if any, before 2019-09-11 14:26:22 +00:00
Unit
Verifier [Intrinsic] Add the llvm.umul.fix.sat intrinsic 2019-09-07 12:16:14 +00:00
YAMLParser
tools Reland "Change the X86 datalayout to add three address spaces 2019-09-10 23:15:38 +00:00
.clang-format
CMakeLists.txt [llvm-ifs][IFS] llvm Interface Stubs merging + object file generation tool. 2019-08-30 18:26:05 +00:00
TestRunner.sh
lit.cfg.py [llvm-ifs][IFS] llvm Interface Stubs merging + object file generation tool. 2019-08-30 18:26:05 +00:00
lit.site.cfg.py.in