[all-commits] [llvm/llvm-project] fec294: Revert "[GVN] Clobber partially aliased loads."
Jordan Rupprecht via All-commits
all-commits at lists.llvm.org
Tue May 11 16:09:49 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: fec2945998947f04d672e9c5f33b57f7177474c0
https://github.com/llvm/llvm-project/commit/fec2945998947f04d672e9c5f33b57f7177474c0
Author: Jordan Rupprecht <rupprecht at google.com>
Date: 2021-05-11 (Tue, 11 May 2021)
Changed paths:
M llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
M llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
M llvm/lib/Transforms/Scalar/GVN.cpp
M llvm/test/Transforms/GVN/PRE/rle.ll
Log Message:
-----------
Revert "[GVN] Clobber partially aliased loads."
This reverts commit 6c570442318e2d3b8b13e95c2f2f588d71491acb.
It causes assertion errors due to widening atomic loads, and potentially causes miscompile elsewhere too. Repro, also posted to D95543:
```
$ cat repro.ll
; ModuleID = 'repro.ll'
source_filename = "repro.ll"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%struct.widget = type { i32 }
%struct.baz = type { i32, %struct.snork }
%struct.snork = type { %struct.spam }
%struct.spam = type { i32, i32 }
@global = external local_unnamed_addr global %struct.widget, align 4
@global.1 = external local_unnamed_addr global i8, align 1
@global.2 = external local_unnamed_addr global i32, align 4
define void @zot(%struct.baz* %arg) local_unnamed_addr align 2 {
bb:
%tmp = getelementptr inbounds %struct.baz, %struct.baz* %arg, i64 0, i32 1
%tmp1 = bitcast %struct.snork* %tmp to i64*
%tmp2 = load i64, i64* %tmp1, align 4
%tmp3 = getelementptr inbounds %struct.baz, %struct.baz* %arg, i64 0, i32 1, i32 0, i32 1
%tmp4 = icmp ugt i64 %tmp2, 4294967295
br label %bb5
bb5: ; preds = %bb14, %bb
%tmp6 = load i32, i32* %tmp3, align 4
%tmp7 = icmp ne i32 %tmp6, 0
%tmp8 = select i1 %tmp7, i1 %tmp4, i1 false
%tmp9 = zext i1 %tmp8 to i8
store i8 %tmp9, i8* @global.1, align 1
%tmp10 = load i32, i32* @global.2, align 4
switch i32 %tmp10, label %bb11 [
i32 1, label %bb12
i32 2, label %bb12
]
bb11: ; preds = %bb5
br label %bb14
bb12: ; preds = %bb5, %bb5
%tmp13 = load atomic i32, i32* getelementptr inbounds (%struct.widget, %struct.widget* @global, i64 0, i32 0) acquire, align 4
br label %bb14
bb14: ; preds = %bb12, %bb11
br label %bb5
}
$ opt -O2 repro.ll -disable-output
opt: /home/rupprecht/src/llvm-project/llvm/lib/Transforms/Utils/VNCoercion.cpp:496: llvm::Value *llvm::VNCoercion::getLoadValueForLoad(llvm::LoadInst *, unsigned int, llvm::Type *, llvm::Instruction *, const llvm::DataLayout &): Assertion `SrcVal->isSimple() && "Cannot widen volatile/atomic load!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/rupprecht/dev/opt -O2 repro.ll -disable-output
...
```
More information about the All-commits
mailing list